best way to store extra data ?
best way to store extra data ?
hi,
I'd like to store additional invisible data at each row. That data is an index of element in the source array.
probably I could use just an index from DataTable (they could be the same, but not sure they are always remains the same actually (due to sort etc)).
I tried to add an invisible column, and then access it's value. But seems like I can't get the data if column is invisible.
[code]
// at initianlization
"aoColumnDefs": [ { "bVisible": false, "aTargets": [ 4 ] } ],
..
// at 'click' processing
$('#cox tr').click( function() {
var rr = $('td', this);
var dc = $(rr[0]).text();
var idd = $(rr[4]).text();
alert(dc+' / '+idd); // idd - is epmty if column is invisible :|
} );
[/code]
could you please advice a solution? thank yo very much
I'd like to store additional invisible data at each row. That data is an index of element in the source array.
probably I could use just an index from DataTable (they could be the same, but not sure they are always remains the same actually (due to sort etc)).
I tried to add an invisible column, and then access it's value. But seems like I can't get the data if column is invisible.
[code]
// at initianlization
"aoColumnDefs": [ { "bVisible": false, "aTargets": [ 4 ] } ],
..
// at 'click' processing
$('#cox tr').click( function() {
var rr = $('td', this);
var dc = $(rr[0]).text();
var idd = $(rr[4]).text();
alert(dc+' / '+idd); // idd - is epmty if column is invisible :|
} );
[/code]
could you please advice a solution? thank yo very much
This discussion has been closed.
Replies
[code]
$('#cox tr').click( function() {
// get DT's internal row index for this row (where oTable represents your table).
oTable = $('#cox').dataTable();
iRow = oTable.fnGetPosition(this);
// get data at column 4 from DT's internal data, using iRow
idd = oTable.fnGetData(iRow)[4];
}
[/code]
I appreciate much your help. Thank you very much!
and all the best to you!
-
dm