jqGrid - 当数据类型:local(包括jsFiddle)时,排序不起作用

时间:2014-10-04 18:37:10

标签: arrays sorting types jqgrid local

我无法找到任何解决方案。 我想从本地数组加载我的数据。当我在数据类型不同的网格中使用相同的设置:json,从服务器,一切正常。

但是我需要一个本地数组,我使用数据选项。数组格式为:

[[x,y,z], ...] 

的jsfiddle: http://jsfiddle.net/7osga648/

CODE:

$("#datagrid1").jqGrid({
        datatype:'local',height:350,width:400,gridview:true,rownumbers:true,rowNum:1000,viewrecords:true,
        colNames:["time","col1","col2"],
        colModel:[
       {name:'time',width:150,resizable:false,sorttype:'date',datefmt:"d/m/Y H:i:s"},

        {name:'f1',width:100,resizable:false,sorttype:'number'},
        {name:'f2',width:100,resizable:false,sorttype:'number'}],
        data:[["03/10/2014 20:46:27","60.8","2.5"],["03/10/2014 21:01:39","58.3","0.1"],["03/10/2014 21:16:51","61.3","3.4"],["03/10/2014 21:32:05","58.9","0.6"],["03/10/2014 21:47:18","58.7","0.8"],["03/10/2014 22:02:32","58.2","0.0"],["03/10/2014 22:17:45","61.9","3.8"],["03/10/2014 22:32:58","58.4","0.1"],["03/10/2014 22:48:11","60.0","2.1"],["03/10/2014 23:03:22","61.2","3.4"],["03/10/2014 23:18:34","62.0","3.8"],["03/10/2014 23:33:47","58.6","0.2"],["03/10/2014 23:49:00","58.4","0.2"],["04/10/2014 00:04:14","58.1","0.2"],["04/10/2014 00:19:28","58.1","0.2"],["04/10/2014 00:34:40","61.8","3.9"],["04/10/2014 00:49:51","58.9","0.6"],["04/10/2014 01:05:03","58.2","0.1"],["04/10/2014 01:20:16","61.2","3.4"],["04/10/2014 01:35:28","59.2","0.9"],["04/10/2014 01:50:40","58.4","0.1"],["04/10/2014 02:00:04","0","0"],["04/10/2014 02:05:52","61.8","3.7"],["04/10/2014 02:21:04","62.9","3.7"],["04/10/2014 02:36:15","63.1","3.5"],["04/10/2014 02:51:27","63.7","3.5"],["04/10/2014 03:06:40","60.1","0.0"],["04/10/2014 03:21:53","63.1","3.1"]],
        localReader:{repeatitems:true,cell:""},
        caption:"sorting not working. click on col header"
    });

尝试点击列标题,看看没有发生任何事情。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我已经发布了错误修复here。修改过的演示“jsfiddle.net/7osga648/4/”直接使用了新功能。有关其他信息,请参阅the answer