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 ...
随机推荐
- WinForm应用程序中实现自动更新功能
WinForm应用程序中实现自动更新功能 编写人:左丘文 2015-4-20 近来在给一客户实施ECM系统,但他们使用功能并不是我们ECM制造版提供的标准功能,他们要求对系统作一些定制功能,为了避免因 ...
- Unicode化
为了程序编写方便,根除乱码问题等等需求,很多新项目都采用了Unicode编码.同时,不少使用MBCS多字节编码的旧项目为了升级,也有了转向Unicode编码的意向.不过,从MBCS升级到Unicode ...
- undefined和NAN的区别(转)
Javascript 中 null.NaN和undefined的区别 1.类型分析: js中的数据类型有undefined,boolean,number,string,object等5种,前4种为原始 ...
- uedit富文本编辑器及图片上传控件
微力后台 uedit富文本编辑器及文件上传控件的使用,无时间整理,暂略,参考本地代码.能跑起来.
- Selenium2+python自动化62-jenkins持续集成环境搭建
前言 selenium脚本写完之后,一般是集成到jenkins环境了,方便一键执行. 一.环境准备 小编环境: 1.win10 64位 2.JDK 1.8.0_66 3.tomcat 9.0.0.M4 ...
- springmvc怎么在启动时自己执行一个线程
之前使用springmvc的时候,都是写好controller和对应的数据库操作. 外界发请求的时候,controller进行一堆操作后返回相应的json数据. 似乎springmvc就是外界驱动的一 ...
- TMapCoordinate
MapPiter.Location := TMapCoordinate.Create(59.965, 30.35); MapPiter.Zoom := 10;
- Mysql 索引概论
Mysql性能下降原因 JOIN连接过多 ,索引失效(单值,复合), 查询SQL过水, explian 语法分析SQL性能 https://blog.csdn.net/b1303110335/arti ...
- js中元素结点的引用
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- Controller和View传递数据的几种方式
使用ViewBag存储数据,如ViewBag.time=2012/7/1,View中可以直接用ViewBag("time")的方式取出数据. 使用ViewData存储数据,存储对象 ...