Question

I want to load child nodes on expansion. In the documentation, they mentioned that the request having level, isexpanded, etc. values will be sent to server, when click on expansion icon. But for me no url is being sent to server when i expand any node. What setup i have to do to make it work.

My existing setup is as below :-

jQuery("#tree").jqGrid({
url:'getTasks.htm',
datatype: "json",
mtype:'GET',
colNames: ["id", "no.", "name"],
colModel: [
    {name:'id',width: 30, editable:false, align:"right",sortable:false, hidden: true, key: true},
    {name:'no',width:80, editable:false, align:"left", sortable:true, sorttype:"int"},
    {name:'name', width:150, editable:true, sortable:true, sorttype:"text"}

],

treeGridModel:'adjacency',
treeGrid: true,
gridview:true,
treedatatype: 'json',
cellEdit: true,
ExpandColumn:'name',
cellsubmit : 'clientArray',

jsonReader : {
    root:"listTasks",
    cell:"",
    id: "id",
    repeatitems:false

}

Sample JSON data is :-

[Object { id="16731", no="1", name="name1", level="0", parent="null", isLeaf="false", expanded="false", loaded="true", icon="ui-icon-triangle-1-s"}, Object { id="16737", no="2", name="name2", level="0", parent="null", isLeaf="false", expanded="false", loaded="true", icon="ui-icon-triangle-1-s"}, Object { id="18846", no="3", name="name3", level="0", parent="null", isLeaf="false", expanded="false", loaded="true", icon="ui-icon-triangle-1-s"}, Object { id="-1", no="(new)", parent="null",level="0", isLeaf="false", expanded="false", loaded="true", icon="ui-icon-triangle-1-s"}]
Was it helpful?

Solution

You can find in the documentation of TreeGrid (see here) that the tree parameters: nodeid, parentid, n_level will be sent to the server on expanding of an node in case of treeGridModel:'adjacency'. No "url" should be send.

It is additionally important which value have the value for the loaded hidden column. If you fill all the data in the TreeGrid at the first load you should place true in the column, no request to the server will be send on the node expanding.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top