问题
Appsdk2 rc2 seems to be ignoring the width parameter on columnCfgs for rallygrids.
For example:
xtype: 'rallygrid',
columnCfgs: [
{dataIndex: 'ValueScore', width: 40, text:'Value'}
]
This renders with a 40 pixel width in rc1, but does not in rc2. Is this a bug, or has the parameter changed? Is there a solution for this?
回答1:
This is a bug in the 2.0rc2 release. For now it can be worked around by including flex: null in your column config to override what the grid is doing incorrectly:
xtype: 'rallygrid',
columnCfgs: [
{dataIndex: 'ValueScore', width: 40, text:'Value', flex: null}
]
A defect has been submitted and this should be fixed for the next release.
回答2:
It looks like the bug does not affect grids based on a custom store. Here is an rc2 app (you may see the full code here) with Rally.data.custom.Store where width specified in the clumnCfgs has an expected effect:
_createTestSetGrid: function(testsets) {
var testSetStore = Ext.create('Rally.data.custom.Store', {
data: testsets,
pageSize: 100,
});
if (!this.down('#testsetgrid')) {
this.grid = this.add({
xtype: 'rallygrid',
itemId: 'testsetgrid',
store: testSetStore,
columnCfgs: [
{
text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
},
{
text: 'Test Case Count', dataIndex: 'TestCaseCount',
},
{
text: 'Test Case Status', dataIndex: 'TestCaseStatus', width: 200, //width: 40
},
{
text: 'TestCases', dataIndex: 'TestCases',
renderer: function(value) {
var html = [];
Ext.Array.each(value, function(testcase){
html.push('<a href="' + Rally.nav.Manager.getDetailUrl(testcase) + '">' + testcase.FormattedID + '</a>')
});
return html.join(', ');
}
}
]
});
}else{
this.grid.reconfigure(testSetStore);
}
}
With width set to 200 TestCasesStatus column looks like this:
and with width set to 40 like this:
来源:https://stackoverflow.com/questions/21004026/issue-with-rallygrid-column-width-in-rc2