tags:

views:

402

answers:

1

I'm using a tree grid based on the jQuery plugin jqGrid where I need to do some operations on all child nodes when a user expand a node.

My problem is getting the parent's node id. What I've been trying so far is using the loadComplete option which I know triggers on node expand and by inspecting the post parameters in firebug I see nodeid is correct.

loadComplete: function() {
    $.dump($("#grid-table").getPostData()),
    $.dump($("#grid-table").getPostDataItem('nodeid')),
    $.dump($('#grid-table').getGridParam("nodeid"))
}

This is only giving me empty strings.

A: 

Solved this one myself (I guess the question was too specific). My conclusion was that something reset the nodeid post parameter before the loadComplete event so I used the beforeRequest event instead with nodeid still intact. This might not be the optimal solution, but it's working for me so far.

beforeRequest: function() {
        $("#grid-table").data('nodeid', $(this).getPostDataItem('nodeid'))
},
gridComplete: function() {
        $.dump($("#grid-table").data('nodeid'))
}
Borgenk