【问题标题】:jQuery EasyUI datagrid: Sort on static data not workingjQuery EasyUI datagrid:对静态数据进行排序不起作用
【发布时间】:2013-10-22 06:57:21
【问题描述】:

我有一个非常简单的表格,它使用了 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>

非常感谢任何帮助。

【问题讨论】:

    标签: jquery datagrid jquery-easyui


    【解决方案1】:

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

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

    http://www.jeasyui.com/tutorial/datagrid/datagrid8.php
    

    【讨论】:

    • 抱歉我编辑了错误的帖子我添加了这些属性,我没想到我可以编辑别人的帖子...
    【解决方案2】:

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

    还有属性:

    • 排序名称
    • 排序顺序 试试看....

    【讨论】:

      【解决方案3】:

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

      remoteSort:false
      

      【讨论】:

      • 多么令人愉快的答案!
      【解决方案4】:

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

      <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/

      【讨论】:

        猜你喜欢
        • 2012-10-06
        • 2012-07-19
        • 1970-01-01
        • 2012-01-11
        • 1970-01-01
        • 2013-04-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多