JqGrid setGridParam method in subGridRowExpanded event throws an error

I have successfully configured subgrid, including the subGridRowExpanded callback in my grid. This means that the callback and configuration values ​​are valid.

Now I want to delete the subtitle configuration in order to add it programmatically.

The first step is to set the subtitle to true :

jQuery('#s3list').jqGrid('setGridParam', { subGrid: true }); 

This results in the following error: TypeError: this.p.subGridOptions undefined.

The second step is to add the necessary subGridOptions parameters :

 jQuery('#s3list').jqGrid('setGridParam', {subGridOptions: { reloadOnExpand: false }}); 

This results in the following error: TypeError: bpcolModel [((((n + x) + C) + H)] undefined

Adding my actual callback for subGridRowExpanded has no effect - the error remains the same:

 jQuery('#s3list').jqGrid('setGridParam', { subGridRowExpanded: function(subgrid_id, row_id) { /* lots of valid code */ } }); 

Is it possible at all?

Using jqGrid 4.5.2.

Related Questions / Questions: https://github.com/tonytomov/jqGrid/issues/478

0
source share
1 answer

I suppose there is a misunderstanding what the subGrid: true option subGrid: true . jqGrid add a column with namse subgrid if you are creating a grid with an option. Since you cannot dynamically add a new column to jqGrid , you cannot enable the subGrid option in the grid without recreating it using the GridUnload method (see answer ).

The setGridParam method is stupid. It simply uses $.extend to extend the internal jqGrid option (see source code ). Using the method without taking into account the specifics of the option may violate the functionality of the grid.

There are several scenarios when you can create a grid with a subgrade and hide a column (see the answer and this one ). You should consider in detail whether this approach is suitable for your requirements.

+2
source

Source: https://habr.com/ru/post/1305425/


All Articles