javascript - How to get the selected rows from different pages in a data table using jquery -
i using these script rows data table,but it's giving current page selected row values only.how can rows pages present in data table using jquery.
code:
var tablevalues =[]; $("#table-sparkline").datatable().fndestroy(); var otable2 = $('#table-sparkline').datatable({ "aasorting": [] }); otable2.fncleartable(); //alert("in nth child"); //var values = $(this).html(); //alert(values); var table = $('#example1').datatable(); tablevalues.length=0; tablevalues=(table.rows('.selected').data()); for(var i=0;i<tablevalues.length;i++){ otable2.fnadddata([ tablevalues[i] ]); } }
in order retrieve data, need make separate ajax request mimicking behavior of datatables.
you can use ajax.params()
, gets data submitted datatables server in last ajax request.
function processallrecords(){ var req = $('#example1 table').datatable().ajax.params(); // reset request parameters retrieve records req.start = 0; req.length = -1; req.search.value = ""; // request data $.ajax({ 'url': 'script.php', 'data': req, 'datatype': 'json' }) .done(function(json){ // json.data array of data source objects (array/object), // 1 each row console.log(json); }); }
Comments
Post a Comment