easyui中 datagrid排序的问题

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

1.设置 sortName,sortOrder

2.设置 remoteSort

3.设置sortable

代码  如下:

 

<table id="selectedQuestions" class="easyui-datagrid" title="试题列表" style="width: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',width:80,hidden:true">试题id</th>
                        <th data-options="field:'questionName',width:300,sortable:true">试题名称</th>
                        <th data-options="field:'questionAnwser',width:80,align:'right'">试题答案</th>
                        <th data-options="field:'status',width:80,align:'right'">试题类型</th>
                        <th data-options="field:'departmentName',width:100">所属团队</th>
                        <th data-options="field:'score',width:60,align:'center'">试题分值</th>
                        <!-- <th data-options="width:60,align:'center'"><a href="javascript:void(0)" class="easyui-linkbutton" onclick="save();$('#dlg').dialog('close')">删除</a></th> -->
                    </tr>
                </thead>
            </table>

 

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

posted on 2016-06-02 18:05  java外行  阅读(444)  评论(0编辑  收藏  举报

导航