handsontable-developer guide-setting options,callback

1、cell数组

cell: [
	{row: 0, col: 0, readOnly: true}
]

2、cells函数

cells: function(row, col, prop){
	var cellProperties = {};

	if(row === 0 && col === 0){
		cellProperties.readOnly = true;
	}

	return cellProperties;
}

3、串联设置:第一列可以编辑;第一列的第一行 和 其他 都是只读的。

readOnly: true,
columns: [
  {readOnly: false},
  {},
  {}
],
cells: function (row, col, prop) {
  var cellProperties = {}

  if (row === 0 && col === 0) {
    cellProperties.readOnly = true;
  }

  return cellProperties;
}

4、串联配置模型

//constructor
new Handsontable(document.getElementById('example'), {
  option: 'value'
});
//columns
new Handsontable(document.getElementById('example'), {
  columns: {
    option: 'value'
  }
});
//cells
new Handsontable(document.getElementById('example'), {
  cells: function(row, col, prop) {

  }
});

  

回调函数好复杂:

Handsontable.hooks.getRegistered(): 返回所有注册的函数
给config加个变量就好,如果不知道callback的参数,console.log(arguments)就可以

 

posted on 2015-07-18 10:16  j.w  阅读(309)  评论(1编辑  收藏  举报