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 ...
随机推荐
- 建立SSH隧道从外网访问内网服务器
http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examp ...
- yii2 memcache 跨平台交互 键和值不一样
1 首先在配置文件中加载 web\basic\config\web.php ........ 'components' => [ 'request' => [ // !!! insert ...
- 关于 android百度地图 调用 地理位置 经纬度坐标,只调用一次的解决方法,通知栏不总是 搜索 GPS 。。。
上代码吧... //读取当前坐标 final LocationClient mLocationClient = new LocationClient(mActivity); mLocationClie ...
- HDU 2199 Can you solve this equation?(二分精度)
HDU 2199 Can you solve this equation? Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == ...
- [saiku] saiku-添加数据源以及保证数据源的一致性
采用任何一种添加数据源的方式都不能保证数据源的一致和完整,所以需要两种结合来管理数据源 1.通过saiku的管理台添加数据源 ① 第一种方式:schema和ds都在管理台添加 1)上传schema文件 ...
- 读取配置文件工具demo
//读取配置文件public class ResourcesUtils { /* * @description:根据属性获取文件名 * * @param:propertyName文件的属性名 * * ...
- python推荐书籍
推荐的python电子书 python学习路线图 优先级 入门:python核心编程 提高:python cookbook 其他 (1).数据分析师 需要有深厚的数理统计基础,但是对程序开发能力不做要 ...
- django2.0新增功能流程
1先在 models.py中,创建字段相关的内容,我这里添加一个博客分类的表 定义数据结构的地方 class PostType(models.Model): title = models.CharFi ...
- MATLAB 条形图或饼状图 图案填充
function [im_hatch,colorlist] = applyhatch_pluscolor(h,patterns,CvBW,Hinvert,colorlist, ... dpi,hatc ...
- Sublime Text 3 安装+注册+汉化
参考:https://www.cnblogs.com/h--d/p/7555119.html