Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

changing JQgrid column name dynamically

Tags:

jqgrid

I just need to rename JQgrid column dynamically as per user selection from a list of options. How can I do that?

like image 624
Pokuri Avatar asked Mar 13 '10 19:03

Pokuri


2 Answers

You can use this syntax:

jQuery("#grid1").jqGrid('setLabel', 0, 'NewLabel');

This will change first column name to NewLabel in your grid with id=grid1.

like image 82
Galichev Anton Avatar answered Nov 10 '22 00:11

Galichev Anton


The latest version of jqGrid (4.1+ - possibly earlier) no longer appears to support the column index based setLabel approach described by Galichev, a columnName based approach is provided instead:

jQuery("#grid1").jqGrid('setLabel', 'columnName', 'NewLabel');

See the jqGrid Methods wiki for more information.

I've left the previous answer unedited as this approach may be valid in versions prior to 4.1.

like image 11
Rob Willis Avatar answered Nov 09 '22 22:11

Rob Willis