2016-12-06 69 views
0

,我已要求editItem功能是这样的:如何获得项目值时editItem功能在我jsGrid配置被称为jsGrid

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

console.log,我得到的结果是:

{ 
    "0": { 
    "jQuery223061031009408811742": { 
     "JSGridItem": { 
     "myColumn1": "AB", 
     "myColumn2": "BC", 
     "myColumn3": "CD", 
     } 
    }, 
    "jQuery223061031009408811741": { 
     "events": { 
     "click": [ 
      { 
      "type": "click", 
      "origType": "click", 
      "guid": 67, 
      "namespace": "" 
      } 
     ], 
     "dblclick": [ 
      { 
      "type": "dblclick", 
      "origType": "dblclick", 
      "guid": 68, 
      "namespace": "" 
      } 
     ], 
     "mouseover": [ 
      { 
      "type": "mouseover", 
      "origType": "mouseenter", 
      "data": null, 
      "guid": 69, 
      "namespace": "" 
      } 
     ], 
     "mouseout": [ 
      { 
      "type": "mouseout", 
      "origType": "mouseleave", 
      "data": null, 
      "guid": 70, 
      "namespace": "" 
      } 
     ] 
     } 
    } 
    }, 
    "selector": "", 
    "context": {}, 
    "length": 1 
} 

我真正的领域是jQuery223061031009408811742 -> JSGridItem

我怎样才能得到这些值与功能在jsGrid?或者可能在JSON中有内建函数来解决这个问题?

注意:字段jQuery223061031009408811742每次页面重新加载时都会改变,所以我无法硬编码字段名称来调用它。

回答

0

您可以从行读取数据的jQuery领域JSGridItem获得项目:

var item = $row.data("JSGridItem"); 

但是,为什么你正在重新定义editItem方法目前还不清楚。我建议使用回调onItemEditing