But handsontable can't use jquery to take objects.
var $$ = function (ID) {return document.getElementById (ID); }, Container = $$ (' example1 '), Exampleconsole = $$ (' Example1console '), AutoSave = $$ (' AutoSave '), load = $$ (' Load '), Save = $$ (' save '), autosavenotification, hot;hot = new handsontable (container, {startrows:8, startcols:6, Rowheade Rs:true, Colheaders:true, afterchange:function (change, source) {if (Source = = = ' LoadData ') {return;//don ' T save this change} if (!autosave.checked) {return; } cleartimeout (Autosavenotification); Ajax (' Scripts/json/save.json ', ' GET ', json.stringify ({data:change}), function (data) {Exampleconsole.innertext = ') AutoSaved (' + change.length + ' + ' + ' cell ' + (Change.length > 1?) ' s ': ') + ') '; Autosavenotification = SetTimeout (function () {Exampleconsole.innertext = ' changes'll be autosaved '; }, 1000); }); }}); Handsontable.Dom.addEvent (Load, ' click ', Function () {Ajax (' Scripts/json/load.json ', ' GET ', '), function (rES) {var data = Json.parse (Res.response); Hot.loaddata (Data.data); Exampleconsole.innertext = ' Data loaded '; });}); Handsontable.Dom.addEvent (Save, ' click ', function () {//Save all cell ' s data ajax (' Scripts/json/save.json ', ' GET ', JSON . stringify ({data:hot.getData ()}), function (res) {var response = Json.parse (res.response); if (Response.result = = = ' OK ') {exampleconsole.innertext = ' Data saved '; } else {exampleconsole.innertext = ' Save error '; } });}); Handsontable.Dom.addEvent (AutoSave, ' click ', function () {if (autosave.checked) {exampleconsole.innertext = ' changes would be autosaved '; } else {Exampleconsole.innertext = ' changes is not being autosaved '; }});
Save the data locally
You can set PersistentState to True:persistentstatesave in the initialization or Update method, Persistentstateload (the value exists valueplaceholder.value), Persistentstatereset,
Why use PersistentState? You can separate the data stored by multiple instances.
I don't know how to use it yet.
Handsontable-developer Guide-load and save