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
    }]
    
  • 相关阅读:
    一个很简单的脑筋急转弯问题
    DataGrid PCV排序学习
    VS2010 出现打开关联文档错误的解决方案
    JS 简繁体互转代码
    js 常用正则表达式表单验证代码
    【转】自然语言处理(NLP)网上资源整理
    声卡编程讲解
    视频会议1
    转 语音处理资源
    编译WebRTC
  • 原文地址:https://www.cnblogs.com/wang-jing/p/4656313.html
Copyright © 2011-2022 走看看