I would like to display only a specific set of rows in JQuery Datatables based on some conditions (the query/URL of the page).
I am using REST API to pass the data in AJAX. Here is my full example
$(document).ready(function() {
//datatables
$('#mytable').DataTable({
"ajax": "http://127.0.0.1:8000/api/v1/example/?format=datatables",
"serverSide": true,
"processing": true,
"columns": [
{"data": "col1"},
{"data": "col2"},
{"data": "col3"},
],
"dom": "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-4'p>>",
});
} );
I would like to display only a subset of the rows based on some condition over col1 for example.
Is there a way to specify the rows like we specify the columns?