JQGrid tree - passing additional parameters when tree is expanded
I have a JQGRid tree. It loads data click by click, not all at once.
Typically, JQGRid passes 4 standard tree parameters with开发者_JS百科 each call - row (level, parent, is leaf, is expanded). How can I pass more parameters that I will take from the row being expanded? E.g. data from Name column should be passed in AJAX call too. There doesn't seem to be OnExpand event or similar.
This is resolved by editing grid.treegrid.js
Method: expandNode : function(rc) {
Lines: 344-355
There we can insert custom query parameters before ajax call is made, into PostData array. E.g.
data = $(this).jqGrid("getRowData", rc.id);
$(this).jqGrid("setGridParam",{postData:{customParam:escape(data.SomeColumn),nodeid:rc.id,parentid:rc.parent_id,n_level:rc.level}});
jQuery(”#grid_id”).appendPostData( newdata)
replaces or appends new parameters to the array. newdata should be array of type name;value
more: jqGrid Wiki
精彩评论