[ColVis] : How to know how many columns are curently displayed in the table

[ColVis] : How to know how many columns are curently displayed in the table

lyradlyrad Posts: 8Questions: 3Answers: 0
edited April 2012 in General
Hi,
I use datatables with Service side procesing and ColVis plugin.

I would like to replace text in a column by an image with fnRowCallback fonction (http://datatables.net/usage/callbacks).
My code :
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if ( aData[10] == "details_auth" ){
$('td:eq(3)', nRow).html( '

Replies

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    What you could do is use the plug-in function fnVisibleToColumnIndex ( http://datatables.net/plug-ins/api#fnVisibleToColumnIndex ) to got from visible to column index. There is the inverse function as well (which thinking about it, is probably the one you want... :-) ).

    Allan
  • lyradlyrad Posts: 8Questions: 3Answers: 0
    Thanks, I had a look, i indeed needed the inverse function : fnColumnIndexToVisible.

    I tried
    [code]$('td:eq('+this.fnColumnIndexToVisible(10)+')', nRow).html('.....');[/code] with 10 = index of data column and it runs! Tanks a lot!!!
This discussion has been closed.