ColVis: How can I get the number of buttons in "_fnDomCollection"?

ColVis: How can I get the number of buttons in "_fnDomCollection"?

vtgoalvtgoal Posts: 5Questions: 0Answers: 0
edited February 2014 in Plug-ins
I'm just trying to create the 'show/hide columns' drop down with multiple columns dynamically with a configurable value of max rows, just like:
http://datatables.net/forums/discussion/14186/colvis-new-feature-multiple-dropdown-columns-for-long-lists-of-table-columns

what I'm planing to do is modifying "_fnDomCollection" at
https://github.com/DataTables/ColVis/blob/master/js/dataTables.colVis.js#L665

do something like:
[code]
"_fnDomCollection": function ()
{
var colCount = ???? // something like $('ul.ColVis_collection').children().length / iMaxRow).toString()

return $('', {
'class': !this.s.dt.bJUI ?
"ColVis_collection" :
"ColVis_collection ui-buttonset ui-buttonset-multi"
} )
.css( {
'display': 'none',
'opacity': 0,
'position': ! this.s.bCssPosition ?
'absolute' :
'',
'-moz-column-count': colCount,
'-webkit-column-count': colCount,
'column-count': colCount,
'-webkit-column-gap': '20px',
'-moz-column-gap': '20px',
'column-gap': '20px'
} )[0];
},
[/code]

My question is how can I calculate the column count here? or how can I achieve this at some other place?

Replies

  • vtgoalvtgoal Posts: 5Questions: 0Answers: 0
    ok, seems I can do it by:
    [code]
    var colCount = this.s.iMaxRows ?
    Math.ceil((this.s.dt.aoColumns.length - this.s.aiExclude.length) / this.s.iMaxRows).toString() : '1';
    [/code]
This discussion has been closed.