Using datatables in server-side mode, with YADCL for filtering, is there any way that I can programatically extract the record IDs (e.g. column 0 contains those IDs) for the entire filtered recordset (not just the paginated results shown) such that I can then carry out an action on that recordset.
Example: a 'customers' database table contains 80k records and I use YADCF filtering to narrow that down to a recordset of 1k customers, 20 of which are displayed on the web-page. I would like to have a button on the page, labeled 'Mark all filtered records', that when clicked, fires off an ajax script that changes the 'mark' field on the filtered 1,000 records from 0 to 1.
I can handle the marking of the records independently of datatables, but I don't know how to programatically work out which records need marking i.e. I need to extract some form of recordset identification that I can then use to target with my SQL UPDATE action. Any ideas anyone?
I had a similiar problem, here's what I did:
The tricky detail was the drawCallback-function:
function (settings) {
dtObj = this.api();
var dtData = dtObj.column(0,{ search: 'applied', selected: true }).data().toArray();
$("#dtdata").val(JSON.stringify(dtData));
}
column
-call is the index of the column you're interested in (0 has my index)