Can hidden columns be populated with .row.add() ?

Can hidden columns be populated with .row.add() ?

uskerineuskerine Posts: 33Questions: 15Answers: 0

Hi,

While using .row.add() to add row to a given datatables.. does it populate also hidden columns?

*** If the following row is added:

fooTable.row.add( [
'101',
'Product 101',
200,
'flagYes', // this column is hidden in the datatables definition for fooTable ( { "bVisible": false, "aTargets": [ 3 ] } )
'300'
] ).draw();

*** A later inspection by:

for(i=0;i<5;i++){
alert( 'i=' + i + ' value=' + fooTable.cell(myrow,i).data());
}

will show that while visible columns are properly populated, hidden column value is"undefined".

Is there any way to add new rows loading also data into the hidden columns?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 56,187Questions: 1Answers: 8,897 Site admin
    Answer ✓

    does it populate also hidden columns?

    Yes it should! Can you link me to a test case showing the issue? That really should work! Another check to make would be row( myrow ).data(). It is possible cell().data() has a bug in it...

    Thanks,
    Allan

  • uskerineuskerine Posts: 33Questions: 15Answers: 0

    Thanks for answering, it really helps to know that it has to work.

    I don't know what was wrong but after replicating in jsfiddle it works both in the application and in fiddle. I guess there was some mismatched quotes or something like that.

    Just in case it helps somebody else, I attach the fiddle:

    http://jsfiddle.net/f6fM8/2/

  • allanallan Posts: 56,187Questions: 1Answers: 8,897 Site admin

    Good to hear it works now!

    Allan

This discussion has been closed.