Using colReorder with colVis : issue with aiExclude
Using colReorder with colVis : issue with aiExclude
I'm able to use colVis and show/hide columns. I can also successfully get columns to drag and drop. And, furthermore, they are working together.
However, I'm having difficulty with:
[code]'oColVis': {'aiExclude': [ 0 ]}[/code]
I have one column I do not want to show up in the Show/Hide dropdown, hence the need for this command. But when implemented, I get an error after I've reordered the columns. I can narrow it down to fnRebuild in ColVis.js and when I change
[code]for ( var i=this.dom.buttons.length-1 ; i>=0 ; i-- )[/code]
to
[code]for ( var i=this.dom.buttons.length-1 ; i>=1 ; i-- )[/code]
it works. Is there a better way to do this though?
However, I'm having difficulty with:
[code]'oColVis': {'aiExclude': [ 0 ]}[/code]
I have one column I do not want to show up in the Show/Hide dropdown, hence the need for this command. But when implemented, I get an error after I've reordered the columns. I can narrow it down to fnRebuild in ColVis.js and when I change
[code]for ( var i=this.dom.buttons.length-1 ; i>=0 ; i-- )[/code]
to
[code]for ( var i=this.dom.buttons.length-1 ; i>=1 ; i-- )[/code]
it works. Is there a better way to do this though?
This discussion has been closed.
Replies
set i=>1 will only work if you exclude column 0. better you check if the button was set
[code]
/* Remove the old buttons */
for ( var i=this.dom.buttons.length-1 ; i>=0 ; i-- )
{
if (this.dom.buttons[i] != null)
this.dom.collection.removeChild( this.dom.buttons[i] )
}
[/code]
[code]
"_fnAddButtons": function ()
{
// init - aiExclude to String-Array - fst. time table in right order
if (this.s.aiExclude.length>0 && !isNaN(this.s.aiExclude[0])){
for (var i=0; i
[code]
// init - aiExclude to String-Array - fst. time table in right order
if (this.s.aiExclude.length>0 && !isNaN(this.s.aiExclude[0])){
for (var i=0; i