Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 可手持自定义单元类型_Jquery_Handsontable - Fatal编程技术网

Jquery 可手持自定义单元类型

Jquery 可手持自定义单元类型,jquery,handsontable,Jquery,Handsontable,大家好。我想为handsontable定制手机类型,这样就可以像这样调用它: //custom renderer Handsontable.AttestationRenderer = function (instance, TD, row, col, prop, value, cellProperties) { if (Handsontable.helper.isNumeric(value)) { if (typeof cellProperties.language !== 'und

大家好。我想为handsontable定制手机类型,这样就可以像这样调用它:

//custom renderer
Handsontable.AttestationRenderer = function (instance, TD, row, col, prop, value, cellProperties) {
  if (Handsontable.helper.isNumeric(value)) {
    if (typeof cellProperties.language !== 'undefined') {
      numeral.language(cellProperties.language)
    }
    value = numeral(value).format(cellProperties.format || '0'); //docs: http://numeraljs.com/
    instance.view.wt.wtDom.addClass(TD, 'htNumeric');
  }
  td.addClass('attestationCell');
  Handsontable.TextRenderer(instance, TD, row, col, prop, value, cellProperties);
};  

//custom cell
Handsontable.AttestationCell = {
  editor: Handsontable.TextEditor,
  renderer: Handsontable.NumericRenderer2,
  validator: Handsontable.NumericValidator,
  dataType: 'number'
};

//here setup the friendly aliases that are used by cellProperties.type
Handsontable.cellTypes = {
  text: Handsontable.TextCell,
  date: Handsontable.DateCell,
  numeric: Handsontable.NumericCell,
  attestation: Handsontable.AttestationCell,
  checkbox: Handsontable.CheckboxCell,
  autocomplete: Handsontable.AutocompleteCell,
  handsontable: Handsontable.HandsontableCell
};

var hotcontainer = $('#example');

hotcontainer.handsontable({
columns: [
        {data : "id", type : "numeric"}
        ,{data : "att", type : "attestation"}
    ]
,data : [{id:1, att : 10},{id:10, att:100}]
});
基本上,它将扩展数值类型,并为单元格和属性添加额外的类。 但现在我得到了一个错误:“TypeError:method不是一个函数”

很抱歉打扰大家( 唯一的问题是

renderer: Handsontable.NumericRenderer2,
而不是

renderer: Handsontable.AttestationRenderer,
对不起,打扰你们了( 唯一的问题是

renderer: Handsontable.NumericRenderer2,
而不是

renderer: Handsontable.AttestationRenderer,

你想要什么帮助?更新的代码,我不知道为什么会出错..你想要什么帮助?更新的代码,我不知道为什么会出错。。