zoukankan      html  css  js  c++  java
  • handsontable-developer guide-cell type

    单元格类型:这里有很多没见过的用法,得好好总结一下

    //预定义的类型
    Text Numeric Checkbox Date Select Dropdown Autocomplete Password Handsontable in Handsontable Custom
    var data = [
        {id: 1, name: 'Ted', isActive: true, color: 'orange', date: '2015-01-01'},
        {id: 2, name: 'John', isActive: false, color: 'black', date: null},
        {id: 3, name: 'Al', isActive: true, color: 'red', date: null},
        {id: 4, name: 'Ben', isActive: false, color: 'blue', date: null}
      ],
      container = document.getElementById('example'),
      hot,
      yellowRenderer,
      greenRenderer;
    
    yellowRenderer = function(instance, td, row, col, prop, value, cellProperties){
      //renderer,少加了个s Handsontable.renderers.TextRenderer.apply(this, arguments); td.style.backgroundColor = 'yellow'; }; greenRenderer = function(instance, td, row, col, prop, value, cellProperties){ Handsontable.renderers.TextRenderer.apply(this, arguments); td.style.backgroundColor = 'green'; }; hot = Handsontable(container, { data:data, startRows: 5, colHeader: true, minSpareRows: 1, columns: [ {data:'id'}, {data:'name', renderer:yellowRenderer}, {data:'isActive', type:'checkbox'},
      //date写成了data {data:'date', type:'date', deteFormat:'YYYY-MM-DD'}, {data:'color', type:'autocomplete', source:['yellow', 'red', 'orange', 'blue', 'green']} ], cell: [ {row:1, col:0, renderer: greenRenderer} ], cells: function(row, col, prop){ if(row === 0 && col === 0){ this.renderer = greenRenderer; } } });
    columns: [{
      type: 'text'
    }]
    等于
    columns: [{
      renderer: Handsontable.renderers.TextRenderer,
      editor: Handsontable.editors.TextEditor
    }]
    
  • 相关阅读:
    Ubuntu Mysql
    Ubuntu配置大全
    MyEclipse 手动安装 Subclipse 插件
    解决 Ubuntu 11.10 在 RTL8111/8168B 网卡下速度慢的问题
    Ubuntu 多硬盘 LVM 方式安装
    关于编码转换
    Ubuntu 安装时(initramfs) Unable to find a medium containing a live file system错误的解决
    关于 DirectShow 中各个例子的编译转换问题
    ubuntu 中文设置
    javascript 处理鼠标右键事件
  • 原文地址:https://www.cnblogs.com/wang-jing/p/4656313.html
Copyright © 2011-2022 走看看