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
    }]
    
  • 相关阅读:
    [Python]计算豆瓣电影TOP250的平均得分
    [Golang]使用自建代理访问指定网站
    HDU 2689.Sort it-冒泡排序
    HDU 1728.逃离迷宫-BFS
    hihoCoder #1498.Diligent Robots
    POJ 2503.Babelfish-sscanf()函数+strcmp()函数+二分
    Codeforces 608 B. Hamming Distance Sum-前缀和
    Codeforces 608 A. Saitama Destroys Hotel
    sscanf()函数
    UVA 11461.Square Numbers
  • 原文地址:https://www.cnblogs.com/wang-jing/p/4656313.html
Copyright © 2011-2022 走看看