handsontable-developer guide-cell function
renderer
展示的数据不是来自于数据源,而是先把DOM和其他信息传给renderer,然后展示。
//五种展示函数
TextRenderer: default
NumericRenderer
AutocompleteRenderer
CheckboxRenderer
PasswordRenderer
自己不能给cell加listener的原因:1、一个cell会多次调用renderer,可能会导致它有多个相同事件监听器;2、cell CRUD scrolling,可能导致cell和listener绑定错误。如果一定要这样做,需要把cell content放在div中,给div加监听器
renderer函数 尽可能的快和简洁
editor
validator
可以是函数或者regex;与renderer和editor相比,validator不需要为每个元素都定义。
renderer,editor,validator是相互联系的
handsontable定义了一些type,来系列化这三个函数,好处如下:
var hot = new Handsontable(document.getElementById('container'), {
columns: [
{
renderer: Handsontable.NumericRenderer,
editor: Handsontable.editors.TextEditor,
validator: Handsontable.NumericValidator
}
]
});
var hot = new Handsontable(document.getElementById('container'), {
columns: [
{
type: 'numeric'
}
]
});
预定义的类型
text
numeric
date
checkbox
password
select
dropdown
autocomplete
handsontable
//function的优先级高于type
var hot = new Handsontable(document.getElementById('container'), {
columns: [
{
type: 'numeric',
validator: customValidator // validator function defined elsewhere
}
]
});
//type='password'没有定义validator,比函数更特殊。
var hot = new Handsontable(document.getElementById('container'), {
validator: customValidator, // validator function defined elsewhere
columns: [
{
type: 'password'
},
{}
]
});
相当于
var hot = new Handsontable(document.getElementById('container'), {
columns: [
{
renderer: Handsontable.PasswordRenderer,
editor: Handsontable.editors.PasswordEditor,
validator: undefined
}
{
renderer: Handsontable.TextRenderer, // text cell type is the default one
editor: Handsontable.editors.TextEditor, // text cell type is the default one
validator: customValidator
}
]
});
//通过function定义的才可以,如果通过type定义的,则返回undefined
var cellProperties = $('#container').handsontable('getCellMeta', 0, 0);
// get cell properties for cell [0, 0]
cellProperties.renderer; // get cell renderer
cellProperties.editor; // get cell editor
cellProperties.validator; // get cell validator
//通过function或者type定义的都可以
getCellRenderer(row, col)
getCellEditor(row, col)
getCellValidator(row, col)
handsontable-developer guide-cell function的更多相关文章
- Intel® Threading Building Blocks (Intel® TBB) Developer Guide 中文 Parallelizing Data Flow and Dependence Graphs并行化data flow和依赖图
https://www.threadingbuildingblocks.org/docs/help/index.htm Parallelizing Data Flow and Dependency G ...
- 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, Cache Usage Patterns
There are several common access patterns when using a cache. Ehcache supports the following patterns ...
- Ehcache(2.9.x) - API Developer Guide, Searching a Cache
About Searching The Search API allows you to execute arbitrarily complex queries against caches. The ...
- 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 ...
- Ehcache(2.9.x) - API Developer Guide, Cache Eviction Algorithms
About Cache Eviction Algorithms A cache eviction algorithm is a way of deciding which element to evi ...
- 移动端目标识别(2)——使用TENSORFLOW LITE将TENSORFLOW模型部署到移动端(SSD)之TF Lite Developer Guide
TF Lite开发人员指南 目录: 1 选择一个模型 使用一个预训练模型 使用自己的数据集重新训练inception-V3,MovileNet 训练自己的模型 2 转换模型格式 转换tf.GraphD ...
- Ehcache(2.9.x) - API Developer Guide, Basic Caching
Creating a CacheManager All usages of the Ehcache API start with the creation of a CacheManager. The ...
- Ehcache(2.9.x) - API Developer Guide, Using Explicit Locking
About Explicit Locking Ehcache contains an implementation which provides for explicit locking, using ...
- Ehcache(2.9.x) - API Developer Guide, Blocking and Self Populating Caches
About Blocking and Self-Populating Caches The net.sf.ehcache.constructs package contains some applie ...
随机推荐
- jsp中9个隐含对象
在JSP中一共有9个隐含对象,这个9个对象我可以在JSP中直接使用.因为在service方法已经对这个九个隐含对象进行声明及赋值,所以可以在JSP中直接使用. - pageContext 类型:Pag ...
- jsp---猜数字游戏,深有感触
猜数字游戏注意两点.1.随机数和猜的数字不能放在同一个页面,不然随机数不停出现,猜的数字不可能相等的. 2.数据类型的相互转换.包装类Integer和int的用法,前者是类,后者是基本数据类型 cai ...
- [转]Explorer.exe的命令行参数
本文来自:Explorer.exe的命令行参数 摘要 本文讲述explorer.exe(资源管理器)的命令行. 语法 EXPLORER.EXE [/n][/e][,/root,<object&g ...
- [原创][C#.Winform 控件]Krypton Suite comments
命名空间:ComponentFactory.Krypton.Toolkit 最新版本:v4.4.0 官网状态:已停用 下载地址1:http://downloads.informer.com/krypt ...
- 5月23日笔记-js绑定事件、解绑事件、复合事件
each() $("p").each(function(i,ele){ //alert(ele.innerHTML); alert($("p:eq("+i+&q ...
- Python中常见的数据类型总结
Python提供多种数据类型来存放数据项集合,主要包括序列(列表list和元组tuple),映射(如字典dict),集合(set),下面对这几种一一介绍: 一 序列 1.列表list 列表是一种有序的 ...
- Python开发之用户密码存储
在各种线上应用中,用户名密码是用户身份认证的关键,它的重要性不言而喻.一方面,作为保护用户敏感数据的钥匙来说,一旦被破解,系统将敞开大门完全不设防.另一方面,密码这把钥匙本身就是非常敏感的数据:大多数 ...
- oracle link的创建过程
下面做一个测试,在测试中,创建数据库链接的库为XJ(WINDOWS 2003 ORACLE 10g 10.2.0.1),被链接的库为DMDB(LINUX AS5 ORACLE 10g 10.2.0.1 ...
- 基于 Tornado 实现的 Web 站点反向代理
因为一个奇怪的需求,使用 Python 和 Tornado 框架实现了一个 Web 站点的反向代理.实现的功能是这样: 假设这个反向代理网站的地址是 http://www.example.com 访问 ...
- SpringFox swagger2 and SpringFox swagger2 UI 接口文档生成与查看
依赖: <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> <dependency ...