How to filter datatable with value add with jquery
How to filter datatable with value add with jquery
Dev75
Posts: 5Questions: 2Answers: 0
Hello,
I m using Datatable and i trying to filter value on my last td colomun on text Red or white value..
When i clicked on arrow's filter nothing is happening (no filter action)..
Do you know why?
$('#sst-table-all-contracts').DataTable
({
'createdRow': function (row, data) {
$(row).find("td:eq(1)").attr("id", data[6]);
if (data[7] == null )
{
$(row).find('td:last').css("background", "white");
$(row).find('td:last').text("white");
$(row).find('td:last').css("color", "white");
}
else {
$(row).find('td:last').css("background", "red");
$(row).find('td:last').text("red");
$(row).find('td:last').css("color", "red");
}
},
"aaData": contractsList,
"aoColumns": [ {}, {}]
});
This discussion has been closed.
Answers
Not sure what you mean. Are you clicking the sorting arrows in the column header?
You may need to use Orthogonal Data to setup the ordering and filtering based on the color of the text.
To help us understand what you are trying to do please provide a simple test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
on click on filter on header , data are not filter on text field value –
image of exemple
Are you asking about filtering or sorting?
In either case you would use
columns.render
for thesort
andfilter
types as described in the Orthogonal Data doc I linked to. Look in the Computed Vlaues section of that doc for an example.Kevin