如何在JsGrid中自定义编辑事件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在JsGrid中自定义编辑事件相关的知识,希望对你有一定的参考价值。

我正在使用jsGrid并想知道是否可以如何自定义editButton的onclick事件。基本上,做一些事情,比如显示模态而不是内联编辑。我知道我们可以像这样得到控制列的html输出:

{
    type: 'control',
    itemTemplate: function() {
        var $result = jsGrid.fields.control.prototype.itemTemplate.apply(this, arguments); // Array of string
        return $result;
    }
}

但是如何控制EditButton?谢谢你的帮助。

答案

你可以试试这个:

editItem: function(item) {
  var $row = this.rowByItem(item);
  if ($row.length) {
    console.log('$row: ' + JSON.stringify($row)); // I modify this
    this._editRow($row);
  }
},

在你的jsGrid配置。

除了行// I modify this之外的所有行都是jsGrid的原始源的默认值,所以不要更改它们。

以上是关于如何在JsGrid中自定义编辑事件的主要内容,如果未能解决你的问题,请参考以下文章