ajax页面排序的序号问题

 文章是从我的个人博客上粘贴过来的,

大家也可以访问我的主页 www.iwangzheng.com

目前使用的ajax排序是这样的。

每个table , 都要这样声明 ( table 中必须有2个属性: class, entity_class,(可选属性base_index) tbody tr中,要有 id=“ids_2233”:其中entity_class就是对应的表的名字,class=‘sortable’就是固定的

<table class='sortable' entity_class='CmsAndroidContent' base_index='-1000'>   <!-- base_index is optional --> 
    <tbody>
      <% @records.each do |entity| %>
      <tr id='ids_<%= entity.id %>'>
        <!-- .... -->
      </tr>
      <% end %>
    </tbody>
  </table>


页面拖拽排序首先改变的是装着排序序号的position那一列的值,值的大小起始值是base_index决定的,所以如果想排序后页面的序号是从正数开始,就要改变base_index的值
原文地址:https://www.cnblogs.com/iwangzheng/p/3612933.html