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("#lis开发者_JAVA百科t").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.
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.
精彩评论