any difference between table.row() and table.rows()
any difference between table.row() and table.rows()
jfr
Posts: 71Questions: 24Answers: 0
Hi
I am trying to look at the data of a row to see if there is any negative number in the rowCallBack
"rowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
if (aData) {
console.log("*********** iDisplayIndexFull:"+iDisplayIndexFull)
var rowColumns = oTable.row(iDisplayIndexFull).columns( ".sum_mnt, .sum_qty" );
rowColumns.data().each( function ( value, index ) {
console.log("rowColumns index:"+index+ " value:"+value)
} );
var rowsColumns = oTable.rows([iDisplayIndexFull]).columns( ".sum_mnt, .sum_qty" );
rowsColumns.data().each( function ( value, index ) {
console.log("rowsColumns index:"+index+ " value:"+value)
} );
}
}
both rowColumns and rowsColumns give me exactly the save result
I was hoping to have only 1 row of data with row(iDisplayIndexFull) or row([iDisplayIndexFull]) but I get the data of all rows
Am I wrong in my assumption or in my code ?
Thanks in advance
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I don't think
iDisplayIndex
oriDisplayIndexFull
are what you want - looking at the code (as those two parameters are undocumented - and therefore shouldn't be relied upon) neither is the row index - which is probably way you are running into the problem.What you could do is use
oTable.row( nRow ).data()
to get the data for the row.I knew
rowCallback
needed some work, but that really is a bit of a mess (in that it should give you the data directly, as well as the row index...).Allan
Hi Allan
I did change the index by rRow
Still have the same columns selection
and it is still returning all rows of the table instead the a single row as the following
Thanks
Oh I see - you want to select cells based on a row and column selector? In which case use
cells()
and pass in your row and column selectors to it, rather than chaining rows() and columns() together, which will not work.Allan