Json字符串
[{"Date":"1","Time":"2007-10-01","Tag":"test","JetSpeed":"note","HeadTemp":"200.00","FaultList":"10.00;"},{"Date":"2","Time":"2007-10-02","Tag":"test2","JetSpeed":"note2","HeadTemp":"300.00","FaultList":"20.00;"},{"Date":"3","Time":"2007-09-01","Tag":"test3","JetSpeed":"note3","HeadTemp":"400.00","FaultList":"30.00;"}]
代码
var logtabledata = $.parseJSON(data.Parameters)
当我使用它时,给我阵列对象示例logtable[0]
将是关键是Date
值是1
下一个关键是Faultlist
值是10.00
... ..it按排序顺序排列数据。我需要保持它的顺序。这该怎么做?如何保存订单,以便可以使用相同的订单在网格数据中显示
grid.jqGrid({
datatype: "local",
data: logtabledata
})
从json
解析后我需要相同顺序的数据答案 0 :(得分:0)
根据jqgrid文档,我认为您需要设置colModel
:
描述列参数的数组。这是网格中最重要的部分。
类似的东西:
grid.jqGrid({
datatype: "local",
data: logtabledata,
colModel: [
{ name: 'Date' },
{ name: 'Time' },
{ name: 'Tag' },
{ name: 'JetSpeed' },
{ name: 'HeadTemp' },
{ name: 'FaultList' }
]
});