2013-10-14 27 views
0

我有一個非常簡單的表,它使用jQuery EasyUI最基本的功能,它只是不會爲我排序。這裏是一個JSFiddlejQuery EasyUI datagrid:對不工作的靜態數據進行排序

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

任何幫助是極大的讚賞。

回答

0

我在看jquery-easyui上的排序示例,它看起來像它被設計爲與服務器端(php)數據一起工作。或從數據庫加載到網格中的數據。而不是在你的例子中的硬編碼數據。

看看這個例子..並注意它包含的PHP代碼。你可以在底部下載這個例子。

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

對不起,我編輯的錯誤後,我添加這些屬性,我沒有想到我可以編輯別人的別人的帖子... –

2

客戶端分類所需的全部內容爲:

remoteSort:false 
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/