Inline edit query autosave (hack)

Contains tips for configurators working with Aware IM
Post Reply
hpl123
Posts: 2579
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Inline edit query autosave (hack)

Post by hpl123 »

Hi all,
Here is a hack to autosave a query after a inline edit (and is a hack so not beautiful and can probably be done in a better way but it works). The config is 3 simple steps so not doing a sample BSV:

1. Add the "Save inline edits" operation to the query (so you get the button where a user can save edits) and add ID "saveinlineedit" to the operation
2. Add the following to the query render script:

Code: Select all

setInterval(function(){ if ($('.k-dirty-cell').length){ $( "#saveinlineedit" ).trigger( "click" ); } }, 1000);
3. Open query and edit some editable attribute

The "downside" of this solution is tabbing through different attributes and doing multiple changes in a row is not possible as when the save is performed, the query is refreshed and the tab position is lost etc.. If anyone has additional ideas etc. and/or wants to clean this up (or have done this in a better way), please share. Thanks

PS: This is just something I threw together so have no clue if it might cause other problems, if the dirtycell class is used somewhere else etc. so use at own risk.
Henrik (V8 Developer Ed. - Windows)
hpl123
Posts: 2579
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Inline edit query autosave (hack)

Post by hpl123 »

Update:
To also include checkboxes use the following code in step 2:

Code: Select all

setInterval(function(){ if ($('.k-dirty-cell,.k-dirty').length){ $( "#saveinlineedit" ).trigger( "click" ); } }, 1000);
Henrik (V8 Developer Ed. - Windows)
Post Reply