I am using jqgrid treeview with an asp.net-mvc backend and i see the GUI lets you click on other columns for sorting but i can't find any documentation or examples on how to implement it.
When I click a column heading, my "Loading . . " notification shows up but none of my server side actions are getting called.
I used httpwatch and i don't see any calls trying to hit the server.
Does jqgrid treeview support sorting (this would just be sorting the top level in the tree)?
Here is my code:
$("#treegrid").jqGrid({
url: '/MyController/GetData' + GetQuery(),
datatype: 'json',
footerrow: true,
userDataOnFooter: true,
mtype: 'GET',
rowNum: 2000,
colNames: ["ID", "Description", "Total 1"],
colModel: [{
name: 'id',
index: 'id',
width: 1,
hidden: true,
key: true
}, {
name: 'desc',
width: 240,
index: 'desc',
hidden: false,
sortable: true
},
{
name: 'total1',
sorttype: 'int',
index: 'total1',
unformat: originalValueUnFormatter,
formatter: bookMapFormatter,
align: "right",
width: 60,
hidden: false,
sortable: true
}],
treeGridModel: 'adjacency',
height: 'auto',
loadComplete: function (data) {
},
pager: "#ptreegrid",
treeGrid: true,
ExpandColumn: 'desc',
ExpandColClick: true,
caption: "My Treegrid"
});
function bookMapFormatter(cellvalue, options, rowObject) {
return booksFormatterEx(cellvalue, options, rowObject, "MyAction");
}
function booksFormatterEx(cellvalue, options, rowObject, actionName) {
var regularURL = '/MyController/' + actionName + GetQuery() + '&key=' + rowObject[0];
return "<a target='_blank' href='" + regularURL + "' >" + cellvalue + "</a>";
}
Also if its helpful, i have serialized my json results (using the .net JavascriptSerializer class) (this is just the top level view as i go back to the server when users drill down)
{"page":1,
"total":1,
"records":2,
"userdata":{"desc":"Total:","total1":"10,753"},
"rows":[{
"id":"Group1","cell":["Group1","1 - 1 System(s)",723, 0, null, false, false, true]},
{"id":"Group2","cell":["Group2","2 - 2 System(s)",2120, 0, null, false, false, true]},
{"id":"Group3","cell":["Group3","3 - 3 System(s)",2017, 0, null, false, false, true]},
{"id":"Group4","cell":["Group4","4 - 4 System(s)",1181, 0, null, false, false, true]},
{"id":"Group5","cell":["Group5","5 - 5 System(s)",4712, 0, null, false, false, true]}]}