I am using JQGrid version 4.1.2. With this I am facing some problems in tree grid while using Adjacency model (Load at once). I Am loading the JSON data from a server. Tree grid is getting formed according to the row order from JSON data. Say for ex: I am forming tree grid for Branch & Department. In my query I am not able to sort according to the parent child hierarchy, because around 6 tables I need to join. But I can get the records with proper id, parent, level & is_leaf properties.
What the grid is doing means - just its creating the rows from JSON whatever order it is. So the tree format is not coming up properly. When I click the root node of any department, it's collapsing the correct child but all children are under different parent(according to my JSON order).
Below is the data which I am getting as a JSON from my server.
id name level parent is_leaf expanded loaded
—– —————–—– —–—–—– —–—–—–—– —–—–—–—– —–—–—–—–—– —–—–—–—–—–
B1 Shanghai Pvt Ltd 1 (null) false true true
D3 Finance & Account 2 B1 true true true
D4 Production 2 B1 true true true
D5 Support 2 B1 true true true
D6 Operation 2 B1 false true true
D13 Software 2 B1 true true true
D82 BPO 2 B1 false true true
D76 Sub D12 3 D1 true true true
D75 Sub D11 3 D1 true true true
D78 Sub D21 3 D2 false true true
D84 Operation1 3 D6 true true true
D83 BPO1 3 D82 false true true
D79 Sub D211 4 D78 false true true
D87 BPO11 4 D83 true true true
D80 Sub D2111 5 D79 true true true
D1 Admin 2 B1 false true true
D2 Sales 2 B1 false true true
B13 Beijing Pvt Ltd 1 (null) false true true
D86 Test 2 2 B13 false true true
D134 Test Root 2 B13 true true true
D91 Test Level 1 3 D85 false true true
D93 Test 2 Level 1 3 D86 true true true
D133 Test Level 3 5 D92 true true true
D92 Test Level 2 4 D91 false true true
D85 Test 2 B13 false true true
B14 Branch Office 3 1 (null) false true true
D132 Software 2 B14 false true true
D95 Level 1 3 D132 true true true
D94 Root 2 B14 true true true
D136 Level 2 3 D132 true true true
B15 Branch Office 4 1 (null) true true true
Inside jqgrid function I've defined all of these.
treeGrid: true,
treeGridModel:'adjacency',
ExpandColumn : 'deptName'
Is there anything I am missing/doing wrong, or this is how tree grid works right now?