データはグリッドに正常にロードされますが、ソートされません。
テーブル ヘッダーをクリックすると、並べ替えの矢印が表示されますが、データが並べ替えられません。
ありがとう。
$("#CompTable").jqGrid({
url:'BomExplosionInJsonObj.asp'
, datatype: 'json'
, mtype: 'GET'
, height: 400
, colNames:['Part','Description','Src','Std Usage','Usage Inc Scrap','Rate Scrap','UOM','Item','Unit Cost','Stock']
, colModel:[ {name:'COMP1_PART',index:'Part', width:120}
, {name:'WSCOMPDESC',index:'Desc', width:300}
, {name:'WSCOMPSRC',index:'Src', width:10}
, {name:'COMPUSAGE',index:'Usage', width:80, align:"right",sorttype:"float"}
, {name:'WSGROSSQTY',index:'TotUsage', width:80, align:"right",sorttype:"float"}
, {name:'COMPRATE_SCRAP',index:'Rate Scrap', width:80, align:"right",sorttype:"float"}
, {name:'COMPBASIC_UNIT',index:'UOM', width:20}
, {name:'COMP1_ITEM',index:'Item', width:20}
, {name:'WSCOMPUNITCOST',index:'UnitCost', width:80, align:"right",sorttype:"float"}
, {name:'WSCOMPQTYSTOCK',index:'Stock', width:80, align:"right",sorttype:"float"}
]
, jsonReader: {
root:"rows"
, page: "page"
, total: "total"
, records: "records"
, repeatitems: false
, id: "0"
}
, multiselect: false
, caption: "Bom Detail"
, rowNum: 10000
, autoencode: true
, loadonce: true
, sortable: true
, loadComplete: function() {jQuery("#CompTable").trigger("reloadGrid");}// Call to fix client-side sorting
});
});
返される JSON データ (firebug から読み取ったもの)。
{
"total":"1"
,"page":"1"
,"records":"2"
, "rows":
[
{"ID":1,"WSCOMPDESC":"ZYTEL E101L BLK MOUL ","WSCOMPUNITCOST":7.08,"WSCOMPSRC":"P ","WSCOMPQTYSTOCK":75,"COMPBASIC_UNIT":"KG ","COMPUSAGE":0.0034,"COMPRATE_SCRAP":0,"WSGROSSQTY":0.0034,"COMP1_PART":"1180019 ","COMP1_ITEM":" "
},
{"ID":2,"WSCOMPDESC":"INSERT ","WSCOMPUNITCOST":1.89,"WSCOMPSRC":"P ","WSCOMPQTYSTOCK":400,"COMPBASIC_UNIT":"EA ","COMPUSAGE":2,"COMPRATE_SCRAP":0,"WSGROSSQTY":2,"COMP1_PART":"4OWE195689\/ISS 2 ","COMP1_ITEM":" "
}
]
}