How to customize edit event in JsGrid

天涯浪子 提交于 2019-12-25 07:25:18

问题


I'm using jsGrid and wanna know if it's possible how to customize onclick event of editButton. Basically, doing something like displaying modal instead of inline editing. I know that we can get the HTML output of control column like this :

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

But how to have control on EditButton ? Thanks for your help.


回答1:


You can try this:

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

at your jsGrid config.

All lines except line // I modify this are default from original source of jsGrid, so dont change them.



来源:https://stackoverflow.com/questions/39269223/how-to-customize-edit-event-in-jsgrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!