我想在网格中添加一个按钮,以便用户可以通过传递按钮行中的值来查看给定任务的时间表条目值。网格加载就好了,直到我将按钮添加到columnCfgs。当按钮在那里时,我得到一个“Uncaught TypeError:Object [object Object]没有方法'setSortState'”错误。
{text:'View Time',
xtype: 'button',
listeners: {
click: Ext.bind(this._viewTimeEntryValues(projectId, taskId), this)
}
},
全网格代码:
this.grid = this.add({
xtype: 'rallygrid',
model: model,
defaultSortToRank: true,
showRowActionsColumn: false,
columnCfgs: [
{text:'View Time',
xtype: 'button',
listeners: {
click: Ext.bind(this._viewTimeEntryValues(projectId, taskId), this)
}
},
{text:'Id', dataIndex:'FormattedID'},
{text:'Name', dataIndex:'Name'},
{text:'Project', dataIndex:'Project'}
],
storeConfig: {
context: {
projectScopeUp: false,
projectScopeDown: true
},
filters: this._activeFilters
}
});
答案 0 :(得分:2)
我在this github repo的代码中使用了一个按钮。这是带按钮的网格:
var g = Ext.create('Rally.ui.grid.Grid', {
id: 'g',
store: store,
enableRanking: true,
columnCfgs: [
{text: 'Formatted ID', dataIndex: 'FormattedID'},
{text: 'Name', dataIndex: 'Name'},
{text: 'State', dataIndex: 'State'},
{text: 'Last Revision',
renderer: function (v, m, r) {
var id = Ext.id();
Ext.defer(function () {
Ext.widget('button', {
renderTo: id,
text: 'see',
width: 50,
handler: function () {
that._getRevisionHistory(data, r.data);
}
});
}, 50);
return Ext.String.format('<div id="{0}"></div>', id);
}
}
],
height: 400,
});