1

我有一个使用 jQuery EasyUI 最基本功能的非常简单的表格,但它不会为我排序。这是一个JSFiddle

<html>
<head>
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo.css">

    <script src="http://www.jeasyui.com/easyui/jquery.min.js"></script>
    <script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body>
    <table class="easyui-datagrid" title="Unallocated Subnets" data-options="singleSelect:true">
        <thead>
            <tr>
                <th data-options="field:'a',width:80,sortable:true">A</th>
                <th data-options="field:'b',width:80,sortable:true">B</th>
                <th data-options="field:'c',width:80,sortable:true">C</th>
                <th data-options="field:'d',width:80,sortable:true">D</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>a</td><td>a</td><td>a</td><td>a</td>
            </tr>
            <tr>
                <td>b</td><td>b</td><td>b</td><td>b</td>
            </tr>
        </tbody>
    </table>
</body>

任何帮助是极大的赞赏。

4

4 回答 4

4

客户端排序所需的只是设置:

remoteSort:false
于 2013-12-30T11:18:50.117 回答
0

你可以试试这样的代码,它的工作

<table class="easyui-datagrid" title="somedata" sortName="a" sortOrder="desc" remoteSort="false">
<thead>
    <tr>
        <th field="a" width="80" sortable="true">A</th>
        <th field="b" width="80">B</th>
        <th field="c" width="80">C</th>
        <th field="d" width="80">D</th>
    </tr>
</thead>

在这里试试http://jsfiddle.net/kapasaja/gyMQr/6/

于 2014-12-05T04:20:42.967 回答
0

我正在寻找相同的功能。看来您需要根据这篇文章定义自己的排序器 http://www.jeasyui.com/tutorial/datagrid/datagrid14.php

还有属性:

  • 排序名称
  • sortOrder 试一试....
于 2013-10-16T07:38:33.120 回答
0

我正在查看 jquery-easyui 上的排序示例,它看起来像是为处理服务器端(php)数据而设计的。或从数据库加载到网格中的数据。而不是像您的示例中那样的硬编码数据。

看看这个例子..并注意其中包含的 php 代码。您可以在底部下载示例。

http://www.jeasyui.com/tutorial/datagrid/datagrid8.php
于 2013-10-14T18:30:27.993 回答