无法在 'rallytreegrid' 中创建自定义(虚拟)字段,但可以在 'rallygrid' 中创建
Unable to create Custom (Virtual) fields in 'rallytreegrid' but can in 'rallygrid'
如果我使用 'rallygrid',我可以创建如下所示的自定义列:
xtype: 'rallygrid',
columnCfgs: [
'FormattedID',
'Name',
{
text: 'Custom Value',
renderer: function(value, meta, record) {
return myArray[record.data.FormattedID].myValue;
}
}],
context: this.getContext(),
enableBulkEdit: true,
showRowActionsColumn: true,
storeConfig: {
model: 'PortfolioItem/Feature',
pageSize: 25
}
当我这样做时,我的 'Custom Value' 会做我想做的事。万岁!!
但是,如果我用下面的 'rallytreegrid' 替换它,它会出错:
Ext.create('Rally.data.wsapi.TreeStoreBuilder').build({
models: ['portfolioItem/feature'],
autoLoad: true,
enableHierarchy: true
}).then({
success: this._onStoreBuilt,
scope: this
});
_onStoreBuilt: function(store) {
this.add({
xtype: 'rallytreegrid',
store: store,
context: this.getContext(),
enableEditing: true,
shouldShowRowActionsColumn: true,
enableBulkEdit: true,
enableRanking: false,
columnCfgs: [
'FormattedID',
'Name',
{ text: 'Custom Value' }
]
});
}
由于那个 'Custom Value' 字段,我得到了错误,即使有或没有渲染器部分也是如此。
Error: success callback for Deferred transformed result of Deferred transformed result of Deferred transformed result of Deferred threw: TypeError: Unable to get property 'substring' of undefined or null reference
如果我删除那个 'Custom Value' 字段,它会很好用。
请问我做错了什么?
我希望我能为您提供一个好的答案 - 这似乎是一个错误。幸运的是,它很容易变通——您只需要为该列添加 xtype。常规网格必须正确默认此设置,而树状网格则不是。
{
xtype: 'gridcolumn',
text: 'Custom Value',
renderer: function(value, meta, record) {
return 'rendered output goes here';
}
}
如果我使用 'rallygrid',我可以创建如下所示的自定义列:
xtype: 'rallygrid',
columnCfgs: [
'FormattedID',
'Name',
{
text: 'Custom Value',
renderer: function(value, meta, record) {
return myArray[record.data.FormattedID].myValue;
}
}],
context: this.getContext(),
enableBulkEdit: true,
showRowActionsColumn: true,
storeConfig: {
model: 'PortfolioItem/Feature',
pageSize: 25
}
当我这样做时,我的 'Custom Value' 会做我想做的事。万岁!!
但是,如果我用下面的 'rallytreegrid' 替换它,它会出错:
Ext.create('Rally.data.wsapi.TreeStoreBuilder').build({
models: ['portfolioItem/feature'],
autoLoad: true,
enableHierarchy: true
}).then({
success: this._onStoreBuilt,
scope: this
});
_onStoreBuilt: function(store) {
this.add({
xtype: 'rallytreegrid',
store: store,
context: this.getContext(),
enableEditing: true,
shouldShowRowActionsColumn: true,
enableBulkEdit: true,
enableRanking: false,
columnCfgs: [
'FormattedID',
'Name',
{ text: 'Custom Value' }
]
});
}
由于那个 'Custom Value' 字段,我得到了错误,即使有或没有渲染器部分也是如此。
Error: success callback for Deferred transformed result of Deferred transformed result of Deferred transformed result of Deferred threw: TypeError: Unable to get property 'substring' of undefined or null reference
如果我删除那个 'Custom Value' 字段,它会很好用。
请问我做错了什么?
我希望我能为您提供一个好的答案 - 这似乎是一个错误。幸运的是,它很容易变通——您只需要为该列添加 xtype。常规网格必须正确默认此设置,而树状网格则不是。
{
xtype: 'gridcolumn',
text: 'Custom Value',
renderer: function(value, meta, record) {
return 'rendered output goes here';
}
}