본문 바로가기
Language & Library/jqGrid

jqGrid 헤더 클릭 시 정렬 (jqGrid header sort)

by 댓츠굿 2013. 12. 31.


우선 참고 사이트 보기 ( http://trirand.com/blog/jqgrid/jqgrid.html )



[jqGrid Demos] -> [Items] 창에서 

[New in version 3.6] -> [Sortable Rows] 참조





나 같은 경우 위와 같은 방식으로 했는데 헤더를 클릭해도 정렬이 안되었다.. --;

그래서 아래와 같이 sortable: true loadonce : true 를 넣으니 되었다.

jQuery("#sortrows").jqGrid({</span> <b><span style="color: rgb(9, 0, 255);"> <span style="color: rgb(0, 85, 255);"> <b><span style="color: rgb(9, 0, 255);"><b>sortable: true</b></span></b> </span>, </span> </b> url:'server.php?q=2', datatype: "json", colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name asc, invdate', width:100}, {name:'amount',index:'amount', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"}, {name:'total',index:'total', width:80,align:"right"}, {name:'note',index:'note', width:150, sortable:false} ], rowNum:10, width:700, rowList:[10,20,30], pager: '#psortrows', sortname: 'invdate', viewrecords: true, sortorder: "desc", caption:"Sortable Rows Example",</span> <b><span style="color: rgb(9, 0, 255);"> <span style="color: rgb(9, 0, 255);"> <b><span style="color: rgb(9, 0, 255);">loadonce : true</span></b> </span> </span> </b> });


반응형