handsontable-developer guide-load and save
不过handsontable不能用jquery取对象
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,
rowHeaders: 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 will 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 will be autosaved';
}
else {
exampleConsole.innerText ='Changes will not be autosaved';
}
});
把数据保存在本地
可在初始化或更新方法中设置persistentState为true:persistentStateSave, persistentStateLoad(把value存在valuePlaceholder.value), persistentStateReset,
为什么要使用persistentState?可以把多个实例存储的数据分隔开。
还不知道怎么用。
handsontable-developer guide-load and save的更多相关文章
- load、save方法、spark sql的几种数据源
load.save方法的用法 DataFrame usersDF = sqlContext.read().load("hdfs://spark1:9000/users.pa ...
- SparkSQL读写外部数据源-基本操作load和save
数据源-基本操作load和save object BasicTest { def main(args: Array[String]): Unit = { val spark = SparkSessio ...
- 37、数据源之通用的load和save操作
一.通用的load和save操作 1.概述 对于Spark SQL的DataFrame来说,无论是从什么数据源创建出来的DataFrame,都有一些共同的load和save操作. load操作主要用于 ...
- Qt Load and Save Image Dialog 加载图片对话框
在Qt中,我们想要通过对话框来打开某一个图片,可以通过使用QFileDialog来快速实现,参见以下代码: QString fileName = QFileDialog::getOpenFileNam ...
- Ehcache(2.9.x) - API Developer Guide, Key Classes and Methods
About the Key Classes Ehcache consists of a CacheManager, which manages logical data sets represente ...
- Ehcache(2.9.x) - API Developer Guide, Write-Through and Write-Behind Caches
About Write-Through and Write-Behind Caches Write-through caching is a caching pattern where writes ...
- spark SQL学习(load和save操作)
load操作:主要用于加载数据,创建出DataFrame save操作:主要用于将DataFrame中的数据保存到文件中 代码示例(默认为parquet数据源类型) package wujiadong ...
- Yii 2 load() 和 save()
我这里用的数据库是mongo 数据库 为栗子: public function load($data, $formName = null) { $scope = $formName === null ...
- netcore XmlDocument 使用Load和Save方法
string path ="C://xxx/file" XmlDocument xmlDoc = new XmlDocument(); #if NET462 xmlDoc.Load ...
- Ehcache(2.9.x) - API Developer Guide, Cache Usage Patterns
There are several common access patterns when using a cache. Ehcache supports the following patterns ...
随机推荐
- 根据现有表操作基于active record的model
指南上都是直接生成mode,然后db migrate来生成数据库,在现实场景中,很可能是反过来的 例如 测试表app_versions rails里面,建立model class AppVersion ...
- Excel VBA 找出选定范围不重复值和重复值
Sub 找出选定范围内不重复的值() On Error Resume Next Dim d As Object Set d = CreateObject("scripting.diction ...
- JWPlayer快速入门指南(中文)
将JW Player嵌入到网页中非常的简单,只需要进行如下3个步骤: 1.解压mediaplayer-viral.zip文件,将jwplayer.js和player.swf文件拷贝到工程中: 2.在页 ...
- 030:Cetus中间件和MHA读写分离
030:Cetus中间件和MHA读写分离 line:V1.1 mail: gczheng@139.com date: 2018-08-30 一.主机环境 虚拟机配置 CPU 内存 硬盘 OS版本 My ...
- 给iOS开发新手送点福利,简述UIButton的属性和用法
UIButton属性 1.UIButton状态: UIControlStateNormal // 正常状态 UIControlStateHighlighted // 高 ...
- javascript的中的new
考察 ECMAScript 语言规范中 new 运算符的定义: The new Operator The production NewExpression : new NewExpression is ...
- 如何优化Java垃圾回收-zz
为什么需要优化GC 或者说的更确切一些,对于基于Java的服务,是否有必要优化GC?应该说,对于所有的基于Java的服务,并不总是需要进行GC优化,但前提是所运行的基于Java的系统,包含了如下参数或 ...
- c++类对象 指针区别
class Test{ public: int a; Test(){ a = ; } }; int main1() { Test* t1 = new Test(); t1->a = ; Test ...
- 用MyEclipse JPA创建项目
http://www.myeclipsecn.com/learningcenter/persistence-development/myeclipse-jpa/ 用MyEclipse JPA创建项目 ...
- openAL在mac下播放音源结束时判断处理
音频播放完毕,自然停止 alGetSourcei(source[0], AL_BUFFERS_QUEUED, &state); NSLog(@"queued number:%d ...