Using colReorder with colVis : issue with aiExclude

Using colReorder with colVis : issue with aiExclude

renbyrdrenbyrd Posts: 7Questions: 0Answers: 0
edited December 2010 in Plug-ins
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?

Replies

  • stefanstefan Posts: 6Questions: 0Answers: 0
    edited January 2011
    I had the same issue, but my probleme was to finde the reorderd column. therefor I changed the aiExclude to a String with titles. (see below)

    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
  • stefanstefan Posts: 6Questions: 0Answers: 0
    sorry little bug ;)

    [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
  • Simon79Simon79 Posts: 8Questions: 1Answers: 0
    Thank you Stefan! I just hit this issue and your code seems to be working perfectly to work around it.
This discussion has been closed.