jquery-bootgrid icon indicating copy to clipboard operation
jquery-bootgrid copied to clipboard

Hide columns from js

Open dragonnn opened this issue 10 years ago • 10 comments
trafficstars

How can I hide columns from js? Like from the dropdown menu

dragonnn avatar Sep 03 '15 11:09 dragonnn

I will upload a new version today which includes that feature.

rstaib avatar Sep 04 '15 07:09 rstaib

Please go here!

rstaib avatar Sep 04 '15 07:09 rstaib

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?

dragonnn avatar Sep 07 '15 06:09 dragonnn

Okay - sorry misunderstood.

rstaib avatar Oct 18 '15 09:10 rstaib

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.

ghost avatar Jan 07 '16 14:01 ghost

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.

dragonnn avatar Jan 07 '16 15:01 dragonnn

Hi dragonnn: yes, fair enough, if we can get the visible columns and show/hide columns that will be fine.

brightertools avatar Jan 07 '16 16:01 brightertools

Hi guys, no updates on this?

afonsorp avatar Sep 23 '16 11:09 afonsorp

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?

hjmf1954 avatar May 22 '17 14:05 hjmf1954

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.

mvcmaker avatar Oct 19 '17 18:10 mvcmaker