tags:

views:

366

answers:

2

How can I get the entire colModel for a jqGrid element? I've gone through the source code a bit and also played around with some tests, but nothing seems to return the actual array.

Thanks.

+2  A: 

You can use getGridParam - just pass the colModel option:

jQuery("#mygrid").jqGrid ('getGridParam', 'colModel');

You can look at the jqGrid docs for getGridParam for more information...

Justin Ethier
Interesting. I tried that but it failed. However, I did come up with a solution. I also did not see 'colModel' as a possible input for getting data, only getCol.
Dave
@Justin. You write absolute correct reference to the jqGrid documentation, but a wrong JavaScript statement. Correct statment should be: `jQuery("#mygrid").jqGrid ('getGridParam', 'colModel');`. It gives jQuery("#mygrid").p['colModel'] back, so it works!
Oleg
@Oleg - Good catch, I just corrected the answer. Thanks!
Justin Ethier
A: 

So I did figure it out. In the custom navigation button (onClickButton function), I just used :

this.p.colModel
Dave