jquery-bootgrid
jquery-bootgrid copied to clipboard
Hide columns from js
How can I hide columns from js? Like from the dropdown menu
I will upload a new version today which includes that feature.
Please go here!
Hmm that not realy what I mean, I want some thing like tkat: $('grid').bootgrid("hide-column", "column-id"). So I can hide columns from outside bootgrid library (I am doing column grouping because I have really big table). Maybe the function used by dropdown menu for columns could be just exposed to methods?
Okay - sorry misunderstood.
It would be a great feature to show/hide columns using JS, or have the ability for the grid to "remember" these settings, for example using cookies or a built in array that we can access and store ourselves.
If you it will be possible to hide via JS and get visiable columns from bootgrid you can easy add this. I think putting cookies into bootgrid is a litte bit overshot.
Hi dragonnn: yes, fair enough, if we can get the visible columns and show/hide columns that will be fine.
Hi guys, no updates on this?
Hi guys, seems an old issue, but still no actions until now. Also there is not much activity on the grid. Does that mean the project 'Bootgrid' is killed?
I've found the solution! It is not very friendly but works fine. The only requirement is that you need to recreate the bootgrid object after do that, and to recreate successfully you must to destroy it before. Just look at the next code that worked for me to understand the idea:
if(_dataGrid !== null && typeof _dataGrid == 'object')
_dataGrid.bootgrid('destroy'); // Required to correctly update the next grid
if(type === 'pending') {
//Remove headers (bootgrid style)
$('th[data-column-id="returner"],th[data-column-id="dtReturn"]').data('visible', false).data('visible-in-selection', false);
}
else {
//Show headers (bootgrid style)
$('th[data-column-id="returner"],th[data-column-id="dtReturn"]').data('visible', null).data('visible-in-selection', null);
}
_dataGrid = $("#grid").bootgrid({
.................................
In my case _dataGrid is a global variable defined by defult as null.