JqGrid Hide / Show Columns

I have an MVC project and am working on a page using JQGrid. I have a popup menu with many checkboxes (one for each grid column), and I'm trying to attach a script to hide / show the column when clicked.

I read many solutions and tried using the hide / show methods from the wiki.

$("ShippingListGrid").hideCol("Open"); 

"Open" is the column name in colModel

 { name: 'Open', index: 'Open', width: 120, align: 'left', editable: true,sortable: true,hidden: false,Key: false, edittype: 'text', editoptions: { size: 20, maxlength: 30}}, 

This does not work, although when I call the function, my grid does not change. I tried reloading my grid and using the column id instead of the name, and the columns still don't change. I have the latest download. Does anyone know why a function might not work?

+4
source share
1 answer

Check your selector, if your grid is the table identifier, you will need the # character. Perhaps try: $("#ShippingListGrid").hideCol("Open");

+2
source

All Articles