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 ...
随机推荐
- How to Install MySQL on CentOS 7
CentOS 7的yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载 # wget http://dev.mysql.com/get/mysql-communit ...
- WCF揭秘学习笔记(3):使用DataContractSerializer
使用DataContractSerializer 终结点(包括地址.绑定.契约)可通过代码以编程方式添加到服务中.如: using(ServiceHost host =new ServiceHost( ...
- C语言课程设计——电影院订票系统
1. 课题简介 大家都爱看电影,现请参考一个熟悉电影票预订系统,实现C语言版的订票系统.了解订票如何实现的.系统主要有2类用户:管理员用户和顾客用户. 管理员用户登录系统后,实现电影放映厅信息管理和电 ...
- Hive插入数据的几种常用方法
Hive的几种常见的数据导入方式这里介绍四种:(1).从本地文件系统中导入数据到Hive表:(2).从HDFS上导入数据到Hive表:(3).从别的表中查询出相应的数据并导入到Hive表中:(4).在 ...
- MongoDB 生态 – 可视化管理工具
工欲善其事,必先利其器,我们在使用数据库时,通常需要各种工具的支持来提高效率:很多新用户在刚接触 MongoDB 时,遇到的问题是『不知道有哪些现成的工具可以使用』,本系列文章将主要介绍 MongoD ...
- C#中DateTime详解
//2008年4月24日 System.DateTime.Now.ToString("D"); //2008-4-24 System.DateTime.Now.ToString(& ...
- Symfony 从路由认识它
经过上一篇文章之后,我们呢,可以访问这个默认的页面,你也会看到一堆高级的debug工具.好了,这次我们开始更多地了解这个symfony2.0. 首先我们要明白一点,Symfony2 的配置是一个着实很 ...
- fabric本地一键部署LAMP
一.添加普通用户jeff执行sudo时无需输入密码 $ sudo vim /etc/sudoers ---------------------------------------> ## All ...
- CTC Loss原理
https://blog.csdn.net/left_think/article/details/76370453 1. 背景介绍 在传统的语音识别的模型中,我们对语音模型进行训练之前,往往都要将文 ...
- 使用mybatis提供的各种标签方法实现动态拼接Sql。使用foreach标签实现遍历查询。比如实现select * from user where id in(1,10,24)这条sql查询语句。
向sql传递数组或List,mybatis使用foreach解析,如下: 需求: 传入多个id查询用户信息,用下边的sql实现: select * from user where id in(1,10 ...