easyui中 datagrid排序的问题

今天做了datagrid排序的问题,也搜集了很多,但是很多好像不太行,醉后 看到一个可以,和在easyui 一个demo有点类似,easyui中的是多行,现在我们来说一说一行怎么处理

1.设置 sortName,sortOrder

2.设置 remoteSort

3.设置sortable

代码  如下:

<table id="selectedQuestions" class="easyui-datagrid" title="试题列表" style="800px;height:400px"
                    data-options="rownumbers:true,singleSelect:false,pagination:true, sortName:'questionName',sortOrder:'asc' remoteSort:false">
                <thead>
                    <tr>
                        <th data-options="field:'ck',checkbox:true"></th>    
                        <th data-options="field:'id',80,hidden:true">试题id</th>
                        <th data-options="field:'questionName',300,sortable:true">试题名称</th>
                        <th data-options="field:'questionAnwser',80,align:'right'">试题答案</th>
                        <th data-options="field:'status',80,align:'right'">试题类型</th>
                        <th data-options="field:'departmentName',100">所属团队</th>
                        <th data-options="field:'score',60,align:'center'">试题分值</th>
                        <!-- <th data-options="60,align:'center'"><a href="javascript:void(0)" class="easyui-linkbutton" onclick="save();$('#dlg').dialog('close')">删除</a></th> -->
                    </tr>
                </thead>
            </table>

其中:remoteSort 这个一定要写,默认是true 要写成false

原文地址:https://www.cnblogs.com/shaoyang/p/5553963.html