0

After I add and remove columns in jqgrid, how do I get a list of the columns that are displayed?

When I call the method:

jQuery("#list").jqGrid('columnChooser',{ "msel_opts": $.ui.multiselect.defaults, "done": function (permut) {
        var colnames = $("#list").jqGrid('getGridParam', 'colModel');
  }
});

Colnames returns back with the original set of columns and not the updated list after the columns have been removed or added.

Cral Zeiss
  • 13
  • 4

1 Answers1

0

I did't test this, but I suppose that the problem that you should first call

$("#list").jqGrid("remapColumns", permut, true);

inside of done event handler and then test the colModel elements for hidden:true property. You should have now not only the correct value of the hidden property, but the correct order of columns too.

Additionally I see no need to use "msel_opts": $.ui.multiselect.defaults option. Probably you have some other problems which you try to fix. I recommend you verify that you included all dependencies of the columnChooser correctly. See here for details.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798