30th Nov 2019how can I get the depot number against checkbox selected
Your code confuses me a little ... Looks like you are not really using the built-in features of Editor and Data Tables a lot.
You want to be able to select a number of rows and then do something with the selected rows. For that reason you want to put the ids (or something else?) of these rows into a string.
Ok, I have something similar. I am using Data Tables Select extension which is really valuable here and "on select" of one or multiple rows I fill an array of something with more values if they aren't in the array yet. That should be pretty much the same as you would require, I guess.
So this is part of the data table definition. Including the settings for the select extension (style: 'os' etc.) and the "on select" event handler that fills my two arrays with data from the selected data table rows.
https://datatables.net/extensions/select/
var acctSystems = [];
var acctSystemProviders = [];
var table = $('#table').DataTable( {
dom: "Bfrltip",
ajax: {
url: 'actions.php?action=whatever'
},
columns: [
...................
{ data: "table.acct_system" },
{ data: "table.acct_system_provider" },
..........
],
select: {
style: 'os',
selector: 'td:not(:first-child)' // no row selection on first column
},
buttons: [
{extend: "editSettings", editor: someEditor},
"selectAll",
"colvis"
]
} );
table.on ( 'select', function (e, dt, type, indexes) {
acctSystems = [];
acctSystemProviders = [];
dt.rows({ selected: true }).every( function ( rowIdx, tableLoop, rowLoop ) {
var data = this.data();
if ( acctSystems.indexOf(data.table.acct_system) < 0 ) {
acctSystems.push(data.table.acct_system);
}
if ( acctSystemProviders.indexOf(data.table.acct_system_provider) < 0 ) {
acctSystemProviders.push(data.table.acct_system_provider);
}
});
})