javascript - How to reload a jquery Datatable after the user finished editing operation? -
i using asp.net mvc4
. want refresh table after user has edited column.(i not want make when user press enter, want refresh when user finishes writing , clicks somewhere else.this jquery
script :
<script language="javascript" type="text/javascript"> $(document).ready(function () { $('#result').datatable().makeeditable(); }); </script>
and controller:
public string updatedata(string id,string value, int columnposition) { objectid oid = new objectid(id); var query = n in objectmongocollection.asqueryable<user>() n.userid == oid select n; user user = query.firstordefault(); if (user == null) { return "error"; } else { if (columnposition == 0) { user.name = value.trim(); } else if (columnposition == 1) { user.surname = value.trim(); } else { user.number = value.trim(); } objectmongocollection.save(user); return "successfull"; } }
i not know function should use , put function on code. (i not know why fndraw method not work) can me? thanks.
use:
$(document).ready(function () { $('#result').datatable().makeeditable(); $('#element').keyup(function(e) { if(e.keycode == 13) { location.reaload(); } }); if($('#element').click()) { location.reaload(); } if($('#element2').click()) { location.reaload(); } });
this method takes optional parameter (true \ false), true means reload server rather cache, default false, meaning default uses web browser's cache.
edit:
notice 13 checks if enter key pressed, number 13 = enter key.
Comments
Post a Comment