jquery - Always retrieving old value (but not new value) from editable DataTable during onblur -
i trying work on creating datatable has editable columns. best example have been able find located on datatables own website: http://www.datatables.net/release-datatables/examples/api/editable.html.
everything works except issue have somehow capturing new value user entered and, onblur, send new value on server side. value sent on original value , not new value user has entered in. note: use handler.ashx handler retrieves new value on server side.
here code display datatable:
$(document).ready(function() { var otable = $('#example').datatable({ "sajaxsource": "displaytable.ashx", "aocolumns": [ { "stitle": "examcode"}, { "stitle": "division" }, ], "fndrawcallback": function() { $('td').editable( 'handler.ashx', { "submitdata": function ( value, settings ) { return { examcode: $(this).parent().find(":first").text(), columnposition: otable.fngetposition( )[2], newvalue: value }; }, onblur : "submit", } ); } }); });
here code handler.ashx:
public class handler : ihttphandler { public string editexamcode(httpcontext context) { string newvalue = context.request.form.get("newvalue"); } }
notice onblur "submit" , value passed on newvalue variable? passed in value original value , not new value user has entered.
is there way around this?
thanks - appreciated!
i don't think need newvalue: value @ all.
try code:
$(document).ready(function() { var otable = $('#example').datatable({ "sajaxsource": "displaytable.ashx", "aocolumns": [ { "stitle": "examcode"}, { "stitle": "division" }, ], "fndrawcallback": function() { $('td').editable( 'handler.ashx', { "submitdata": function ( value, settings ) { return { examcode: $(this).parent().find(":first").text(), columnposition: otable.fngetposition( )[2] }; }, onblur : "submit", } ); } }); });
and handler "value" variable:
public class handler : ihttphandler { public string editexamcode(httpcontext context) { string newvalue = context.request.form.get("value"); } }
Comments
Post a Comment