【问题标题】:Get selected row column value extjs grid获取选定的行列值extjs网格
【发布时间】:2013-09-04 15:49:08
【问题描述】:

我有一个用户网格。要删除一个,请选择您的行并单击“删除”按钮。 但是,这行不通。 我的代码是:

var row = userGrid.getSelectionModel().getSelection();
console.log(row.get('dni'))

火狐说:

TypeError: row.get 不是函数

有什么想法吗?

【问题讨论】:

  • 您确定错误存在吗? fila来自哪里?

标签: javascript extjs grid


【解决方案1】:

最好总是检查hasSelection() like -

if (userGrid.getSelectionModel().hasSelection()) {
   var row = userGrid.getSelectionModel().getSelection()[0];
   console.log(row.get('dni'))
}

【讨论】:

    【解决方案2】:

    也许是因为

    getSelection( ) : Ext.data.Model[]

    返回当前选定记录的数组

    http://docs.sencha.com/ext-js/4-1/#!/api/Ext.selection.Model-method-getSelection

    【讨论】:

    • @ramiromd 换句话说,如果您只想选择第一条记录或者这是一个单一的选择网格,请尝试:var row = userGrid.getSelectionModel().getSelection()[0];
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-20
    • 1970-01-01
    • 2022-01-09
    相关资源
    最近更新 更多