views:

456

answers:

2

I have a JQGRid tree. It loads data click by click, not all at once.

Typically, JQGRid passes 4 standard tree parameters with 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.

+1  A: 

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}});
PHP thinker
A: 

jQuery(”#grid_id”).appendPostData( newdata) replaces or appends new parameters to the array. newdata should be array of type name;value

more: jqGrid Wiki

drep