jquery - Retrieve only modified rows in DataTables -
i render page 2 columns 1 has input fields , other 1 checkboxes. lets modify entry in 1 of input fields , uncheck checkbox in row.
right when click save button , call below code receive onscreen rows without it's properties modified new values (ie. i'm getting original values , states when table loaded).
save: function() { var self = this; var data = json.stringify(this.datatable.rowdata()); var url = this.urls.savescreen; var ajaxoptions = { url: url, data: data, contenttype: "application/json", type: "post"}; }
is there different call available "this.datatable.rowdata()" use receive:
a.) modified rows
b.) rows included changes input fields made user after table loaded.
you can use hidden fields that.. add hidden field element changed in table..
$('table > *').change(function(){ $(this).parent().append('<input type="hidden">changed</input>'); });
now while checking can search rows having hidden input fields having value "changed"
assuming table:
$('input:hidden :contains("changed"').each(function(){ var row=$(this).closest('tr'); var firstelement=row.find('td:eq("0")').text(); var secondelement=row.find('td:eq("1")').text(); // , on });
this code untested, should give workaround on how things should work..
Comments
Post a Comment