Handsontable-developer Guide-load and save

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.