希望通过拖放更改行,并相应地在数据库中保存顺序。我使用了javascript.sortable函数并使用Jquery对其进行排序,但它并没有保存顺序。我想改变和保存两者。你知道吗
<table class="table" id="labourTable">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>L Group</th>
<th>C Group</th>
<th>Order</th>
<th>Image Source</th>
<th>Data Source</th>
</tr>
</thead>
<tbody>
'在表格行中显示劳动力数据'
{% for labor in labours %}
<tr>
<td><input type="checkbox" name="ids" value="{{ labour.id }}" /></td>
<td><a href="{% url 'mapport.laps.lbours.one' map.id labour.i:)
查看jqueryui排序:https://jqueryui.com/sortable/
这样你就可以把你的行排序了。要在数据库中存储顺序,您必须在要排序的模型中添加一个order正整数字段,通过post方法将行顺序发送到视图,并将行保存在视图中,使其按顺序
row_model_instance.order
。你知道吗相关问题 更多 >
编程相关推荐