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 ...
随机推荐
- 黄聪:利用iframe实现ajax 跨域通信的解决方案(转)
原文:http://www.cnblogs.com/xueming/archive/2013/02/01/crossdomainajax.html 在漫长的前端开发旅途上,无可避免的会接触到ajax, ...
- 马士兵Spring-AOP-Aspect例子使用(1)
一.例子1: 1.工程结构: 2. User.java: package com.cy.model; public class User { private String username; priv ...
- selenium 笔记 2018
1.指定浏览器驱动:dr = webdriver.Firefox(executable_path = '/Users/xxx/Documents/selenium_py/geckodriver/gec ...
- 五、jdk工具之jmap(java memory map)、 mat之四--结合mat对内存泄露的分析、jhat之二--结合jmap生成的dump结果在浏览器上展示
目录 一.jdk工具之jps(JVM Process Status Tools)命令使用 二.jdk命令之javah命令(C Header and Stub File Generator) 三.jdk ...
- charles 小米手机安装Charles证书
1.手机Wi-Fi设置手动代理,添加IP和端口号 此处是:192.168.63.143:8888, 2.保存证书,PC端访问 chls.pro/ssl 下载pem证书,发送到手机 adb push c ...
- java DecimalFormat类
今天去面试了,需要上机做题.题目的内容是计算一个货物订单的税费和总价格(包括税费),结果需要精确到两个小数,同时按照如下规则进行处理: 3.01 ——>3.05, 2.48——> ...
- display:table; 也可以实现 div 始终和内包的图片大小相同
display:table; 也可以实现 div 始终和内包的图片大小相同
- MySQL 存储配置
- 实现一个最简单的plot函数调用:
实现一个最简单的plot函数调用: 1 import matplotlib.pyplot as plt 2 3 y=pp.DS.Transac_open # 设置y轴数据,以数组形式提供 4 5 x= ...
- linux 完全卸载mysql数据库
a)查看系统中是否以rpm包安装的mysql [root@linux ~]# rpm -qa | grep -i mysql MySQL-server-5.1.49-1.glibc23 MySQL-c ...