jqgrid nested subgrid 4th level subgrid always returns first rowid of the subgrid

I still suppose that you have some id conflicts between *data in *all** subgrids displayed on the page. For example if you inserts on some level in some from opened grids the data having “1” as the rowid no other data in any subgrid should be inserted with the same subgrid.

For understanding: You use key:true for the "num" column on all level of subgrids. The corresponding value will be not just used in "num" column inside of grid cell (inside of <td>here</td>). It will be also used as the value of id attributes of the row of the grid or subgrid (<tr>). HTML don’t permit id duplicates on the page. So it you do insert elements with id duplicates you can have some strange effects which could be different in different web browsers. For example you will try to select one row and it will be selected another one. You can also have much more hard problems as selection of rows. So you should fill the grids so than ids will be unique on the whole page.

To be sure that the problem with id duplicates is not exists you can use idPrefix option. On the level 0 you can use

idPrefix: "m"

(from main) for example. For the subgrid on the next level you can use

idPrefix: "s" + row_id + "_"

for the next level subgrid

idPrefix: "s" + row_id + "_" + row_id2 + "_"

and

idPrefix: "s" + row_id + "_" + row_id2 + "_" + row_id3 + "_"

The definition of jQuery("#"+subgrid_table_id3) is inside of subGridRowExpanded of subgrids of all previous levels. So you can access row_id and row_id2 defined on the outer scope.

I hope, that after the changes you will don’t have any strange problems like the problems which you described.

here is sample of DUPLICATES

3rd grid when you click to show fourth grid

Leave a Comment