Filtering on DT_RowId
Filtering on DT_RowId
Peter Spegel
Posts: 1Questions: 1Answers: 0
Is it possible to filter on DT_RowId without creating an invisible column? I'm guessing I should create a function:
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
return DT.row(dataIndex).DT_RowId === theIdThatIWantToSearchFor;
});
But I wasn't able to extract the DT_RowId from the DataTable row. Is this only possible by looking at the <tr> using jQuery?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The answer is yes, but it is currently an undocumented feature (simply because I haven't got around to writing the documentation yet - apologies! It is near the top of my top do list now!).
The
dataproperty that is passed in to the custom search function is an array of the data for filtering, however, 1.10.1+ now pass in a couple of other parameters:settings- The settings objectdata- The filter data, in an array, for the rowdataIndex- The row's data index int he tableorigData- The row's original data object / arrayloopCnt- Loop counter for the current filterSo using the new 4th parameter you can simply do
origData.DT_RowIdto access the property you want!Regards,
Allan