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
}]
时间: 2024-10-15 13:12:30

handsontable-developer guide-cell type的相关文章

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 to the cache cause writes to an underlying resource. The cache acts as a facade to the underlying resource. With this pattern, it often makes sense to

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 Graphs In addition to loop parallelism, the Intel® Threading Building Blocks (Intel® TBB) library also supports graph parallelism. It's possible to cre

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 evict when the cache is full. In Ehcache , the memory store and the off-heap store might be limited in size. When these stores get full, elements are evi

Ehcache(2.9.x) - API Developer Guide, Cache Exception Handlers

About Exception Handlers By default, most cache operations will propagate a runtime CacheException on failure. An interceptor, using a dynamic proxy, may be configured so that a CacheExceptionHandler can be configured to intercept Exceptions. Errors

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 development of alternative indexes on values provides the ability for data to be looked up based on multiple criteria instead of just keys. Note: Ter

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 represented as Caches. A Cache object contains Elements, which are essentially name-value pairs. You can use Cache objects to hold any kind of data that you wan

Ehcache(2.9.x) - API Developer Guide, Cache Loaders

About Cache Loaders A CacheLoader is an interface that specifies load() and loadAll() methods with a variety of parameters. CacheLoaders are incorporated into the core Ehcache classes and can be configured in ehcache.xml. CacheLoaders are invoked in

Ehcache(2.9.x) - API Developer Guide, Class Loading

About Class Loading Class loading, within the plethora of environments that Ehcache can be running, could be complex. But with Ehcache, all class loading is done in a standard way in one utility class: ClassLoaderUtil. Plugin Class Loading Ehcache al

Ehcache(2.9.x) - API Developer Guide, Cache Extensions

About Cache Extensions Cache extensions are a general-purpose mechanism to allow generic extensions to a cache. Cache extensions are tied into the cache lifecycle. For that reason, this interface has the lifecycle methods. Cache extensions are create

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 applied caching classes which use the core classes to solve everyday caching problems. Two of these are BlockingCache and SelfPopulatingCache. Blocking Cach