≡
×
Plus
Manual
Examples
Reference
Download
Blog
Community
Support
How do I search for a string in a hidden column and add a class to the row where it is
How do I search for a string in a hidden column and add a class to the row where it is
igonzalez
Posts: 1
Questions: 0
Answers: 0
May 2011
edited May 2011
in
General
Hi, This is my first post, I am new to datatables
How do I:
Search the table for a string in a hidden column and then add a class to the row where it is
Thanks in advanced,
Replies
ChrisGedrim
Posts: 10
Questions: 0
Answers: 0
May 2011
igonzalez,
Assuming that the hidden column you want to search in is the first column; do this:
[code]
var oTable = $('table').dataTable( {
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull){
if (aData[0] == 'valueToSearchFor'){
$(nRow).addClass("new-class-name")
}
return nRow
}
} )
[/code]
This discussion has been closed.
Replies
Assuming that the hidden column you want to search in is the first column; do this:
[code]
var oTable = $('table').dataTable( {
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull){
if (aData[0] == 'valueToSearchFor'){
$(nRow).addClass("new-class-name")
}
return nRow
}
} )
[/code]