4

How do we make a tree grid with pager using jqGrid?

I have checked and try the demos, but it didn't show any pager, even though there is a pager div in the code

How do create the pager ?

Oleg
  • 217,934
  • 30
  • 386
  • 757
strike_noir
  • 3,868
  • 11
  • 50
  • 92

4 Answers4

3

Tree grid has some limitations which are documented:

Pager functionality currently disabled for treeGrid

In other place of the documentation you can read almost the same:

Since jqGrid currently does not support paging, when we have a treegrid the pager elements are disabled automatically.

Oleg
  • 217,934
  • 30
  • 386
  • 757
  • Oleg now i understand it is disabled by the API thank you Anyway can u tell me how to display all the row the grid? because i have like 200 records to show without pager, and even though i set the total page to 1, the grid keeps showing only 20 rows – strike_noir Nov 18 '10 at 03:32
3

I got pagination to work by modifying the setTreeGrid function. I commented out the following line:

$t.p.pgbuttons = false;$t.p.pginput = false;

The buttons then appeared and the requests were going back to the server to request the information. Now for this I was loading the entire tree to a local variable then using setJSONData to load the data into the tree. It functions the way I would expect it to but I haven't thoroughly tested it.

For RowList $t.p.multiselect = false;$t.p.rowList = [10,15,20,30];

JoshD
  • 111
  • 8
  • All depends on what you mean under the "pagination". First: how many items will be on the first or on the second pages? Let us you use "rowNum: 10". How you count the rows: together with all its children or not? What will be if you load a tree having collapsed node having subitems or subnodes and then expand the node?How many nodes will be seen? Still 10? Next you go to the next page and do the same. What I mean to say is that it's not clear which behavior of pagination can be implemented at all. I personally can imagine only scenarios in **local** treegrid or which uses `loadonce:true`. – Oleg Sep 15 '11 at 17:16
  • In the situation I'm using it I'm not concerned with how big the children are as they most often then not will not be expanded. My main concern is being able to page through the parents and splitting based on that. If the client data happens to contain a large number of child nodes then they will just have to wait for it to load. – JoshD Sep 15 '11 at 17:42
1

According to "New functional for treeGrid" Vyacheslav N. Boyko added this feature to jqGrid.And there is a open issue that demands to apply this feature to jqGrid.

Khosro
  • 647
  • 1
  • 7
  • 15
0

Try change d.p.pgbuttons = !1; to d.p.pgbuttons = !0; AND d.p.pginput = !1; to d.p.pginput = !0; AND d.p.rowList = []; to d.p.rowList = [10,50,100]; in block setTreeGrid: function () {...}

Anton
  • 1
  • 1