renderer

展示的数据不是来自于数据源,而是先把DOM和其他信息传给renderer,然后展示。

  1. //五种展示函数
  2. TextRenderer default
  3. NumericRenderer
  4. AutocompleteRenderer
  5. CheckboxRenderer
  6. 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,来系列化这三个函数,好处如下:

  1. var hot = new Handsontable(document.getElementById('container'), {
  2. columns: [
  3. {
  4. renderer: Handsontable.NumericRenderer,
  5. editor: Handsontable.editors.TextEditor,
  6. validator: Handsontable.NumericValidator
  7. }
  8. ]
  9. });
  10.  
  11. var hot = new Handsontable(document.getElementById('container'), {
  12. columns: [
  13. {
  14. type: 'numeric'
  15. }
  16. ]
  17. });

预定义的类型

  1. text
  2. numeric
  3. date
  4. checkbox
  5. password
  6. select
  7. dropdown
  8. autocomplete
  9. handsontable
  1. //function的优先级高于type
    var hot = new Handsontable(document.getElementById('container'), {
  2. columns: [
  3. {
  4. type: 'numeric',
  5. validator: customValidator // validator function defined elsewhere
  6. }
  7. ]
  8. });
  1. //type='password'没有定义validator,比函数更特殊。
    var hot = new Handsontable(document.getElementById('container'), {
  2. validator: customValidator, // validator function defined elsewhere
  3. columns: [
  4. {
  5. type: 'password'
  6. },
  7. {}
  8. ]
  9. });
  10. 相当于
  11. var hot = new Handsontable(document.getElementById('container'), {
  12. columns: [
  13. {
  14. renderer: Handsontable.PasswordRenderer,
  15. editor: Handsontable.editors.PasswordEditor,
  16. validator: undefined
  17. }
  18. {
  19. renderer: Handsontable.TextRenderer, // text cell type is the default one
  20. editor: Handsontable.editors.TextEditor, // text cell type is the default one
  21. validator: customValidator
  22. }
  23. ]
  24. });
  1. //通过function定义的才可以,如果通过type定义的,则返回undefined
    var cellProperties = $('#container').handsontable('getCellMeta', 0, 0);
  2. // get cell properties for cell [0, 0]
  3. cellProperties.renderer; // get cell renderer
  4. cellProperties.editor; // get cell editor
  5. cellProperties.validator; // get cell validator
  1. //通过function或者type定义的都可以
    getCellRenderer(row, col)
  2. getCellEditor(row, col)
  3. getCellValidator(row, col)

  

handsontable-developer guide-cell function的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 移动端目标识别(2)——使用TENSORFLOW LITE将TENSORFLOW模型部署到移动端(SSD)之TF Lite Developer Guide

    TF Lite开发人员指南 目录: 1 选择一个模型 使用一个预训练模型 使用自己的数据集重新训练inception-V3,MovileNet 训练自己的模型 2 转换模型格式 转换tf.GraphD ...

  8. 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 ...

  9. Ehcache(2.9.x) - API Developer Guide, Using Explicit Locking

    About Explicit Locking Ehcache contains an implementation which provides for explicit locking, using ...

  10. 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 ...

随机推荐

  1. 黄聪:利用iframe实现ajax 跨域通信的解决方案(转)

    原文:http://www.cnblogs.com/xueming/archive/2013/02/01/crossdomainajax.html 在漫长的前端开发旅途上,无可避免的会接触到ajax, ...

  2. 马士兵Spring-AOP-Aspect例子使用(1)

    一.例子1: 1.工程结构: 2. User.java: package com.cy.model; public class User { private String username; priv ...

  3. selenium 笔记 2018

    1.指定浏览器驱动:dr = webdriver.Firefox(executable_path = '/Users/xxx/Documents/selenium_py/geckodriver/gec ...

  4. 五、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 ...

  5. charles 小米手机安装Charles证书

    1.手机Wi-Fi设置手动代理,添加IP和端口号 此处是:192.168.63.143:8888, 2.保存证书,PC端访问 chls.pro/ssl 下载pem证书,发送到手机 adb push c ...

  6. java DecimalFormat类

          今天去面试了,需要上机做题.题目的内容是计算一个货物订单的税费和总价格(包括税费),结果需要精确到两个小数,同时按照如下规则进行处理: 3.01 ——>3.05, 2.48——> ...

  7. display:table; 也可以实现 div 始终和内包的图片大小相同

    display:table; 也可以实现 div 始终和内包的图片大小相同

  8. MySQL 存储配置

  9. 实现一个最简单的plot函数调用:

    实现一个最简单的plot函数调用: 1 import matplotlib.pyplot as plt 2 3 y=pp.DS.Transac_open # 设置y轴数据,以数组形式提供 4 5 x= ...

  10. linux 完全卸载mysql数据库

    a)查看系统中是否以rpm包安装的mysql [root@linux ~]# rpm -qa | grep -i mysql MySQL-server-5.1.49-1.glibc23 MySQL-c ...