Javascript 从rallygrid获取所选用户故事

Javascript 从rallygrid获取所选用户故事,javascript,rally,Javascript,Rally,我正在使用以下代码: launch: function() { Rally.data.ModelFactory.getModel({ type: 'UserStory', success: function(model) { this.down('#gridContainer').add({ xtype: 'rallygrid', model: model,

我正在使用以下代码:

launch: function() {
    Rally.data.ModelFactory.getModel({
        type: 'UserStory',
        success: function(model) {
            this.down('#gridContainer').add({
                xtype: 'rallygrid',
                model: model,
                columnCfgs: [
                    {
                        text: 'ID',
                        dataIndex: 'FormattedID',
                        width: 75
                    },
                    {
                        text: 'Name',
                        dataIndex: 'Name',
                        width: 500,
                        listeners: {
                            click: this._showTasks,
                            scope: this
                        }
                    }
                ]
            });
        },
        scope: this
    });
}
当用户从网格中单击用户故事时,会调用函数_showTasks,但我在获取他们单击的用户故事的ID时遇到问题。如果我使用console.log(this),我可以看到ID存储在名为selected的项数组中,但我不确定该属性的路径。我也有这样的印象,也许有一种更简单的方法可以从网格中获取最近选择的用户故事


最终目标是在另一个rallygrid中列出所选用户故事的所有子任务,或者直接打印到正文中。

与其在列上注册单击处理程序,不如在网格上注册选择处理程序:

{
    xtype: 'rallygrid',
    //...
    //more grid config
    //...
    listeners: {
        select: this._onSelect,
        scope: this
    }        
}
然后在onSelect处理程序中有以下记录:

_onSelect: function(rowModel, record, rowIndex, options) {
    var id = record.get('ObjectID');
}

您应该能够在网格上注册选择处理程序,而不是在列上注册单击处理程序:

{
    xtype: 'rallygrid',
    //...
    //more grid config
    //...
    listeners: {
        select: this._onSelect,
        scope: this
    }        
}
然后在onSelect处理程序中有以下记录:

_onSelect: function(rowModel, record, rowIndex, options) {
    var id = record.get('ObjectID');
}