PDA

View Full Version : [INFOREQ] Grid reconfigure isn't taking column alignment config



ma.l
29 Jun 2017, 12:18 PM
This worked in 6.2 but is no longer working in 6.5.

I have column config stored in the viewModel. When I do grid.reconfigure(store, columnsConfig), all column config get set in the grid except for alignment. I can see that the columns has been set to right aligned, but visually, it's stuck on the left.



var grid = this.getView().lookupReference('myGrid'),
store = this.getViewModel().getStore('myStore'),
columns = this.getViewModel().get('myColumns');

grid.reconfigure(store, columns);


// *** inside data object of viewModel

myColumns:
[{
xtype: 'datecolumn',
summaryRenderer: function(val, params, data) {
return Ext.util.Format.plural(val, 'Month');
},
summaryType: 'count',
flex: 1,
sortable: true,
dataIndex: 'bill_month',
text: 'Month',
format: 'M, Y'
}, {
xtype: 'gridcolumn',
flex: 1,
align: 'end',
dataIndex: 'energy_unit',
text: 'UOM'
}, {
xtype: 'numbercolumn',
summaryRenderer: function(val, params, data) {
return Ext.util.Format.number(val, '0,000');
},
summaryType: 'sum',
flex: 1,
align: 'end',
dataIndex: 'usage_total',
text: 'Usage Total',
format: '0,000'
}]


In the pictures, you can see the column has been set to align to the right, but it's still aligned to the left in the grid.
5653456535

evant
29 Jun 2017, 2:07 PM
Please post a test case. I don't see any change in behaviour between 6.2 and 6.5 with this fiddle:

https://fiddle.sencha.com/#view/editor&fiddle/22dh

mjhaston
16 Oct 2017, 4:21 PM
Same issue here. I fixed it the other day by using 'end' instead of 'right'. Did a rebuild today and it's broken again. I can't seem to break your fiddle though.

mjhaston
17 Oct 2017, 7:33 AM
Interesting thing, this morning I notice that as I scroll down the page past the initial page load, the right alignment takes effect.

I had two areas where I was suspending layouts and then reconfigure. If I remove the suspend layouts the alignment works.

I modify your fiddle and it shows the issue.



Ext.application({
name: 'Fiddle',

launch: function () {
var g = new Ext.grid.Panel({
renderTo: document.body,
width: 400,
height: 400,
forceFit: true,
flex: 1,
columns: []
});

setTimeout(function () {
g.suspendLayouts();
g.reconfigure([{
foo: 1.50
}],
[{
dataIndex: 'foo',
formatter: 'usMoney',
align: 'end',
text: 'B'
}]);
g.resumeLayouts(true);
}, 1000);

setTimeout(function () {
g.suspendLayouts();
g.reconfigure([{
foo: 2.25
}],
[{
dataIndex: 'foo',
formatter: 'usMoney',
align: 'end',
text: 'C'
}]);
g.resumeLayouts(true);
}, 3000);
}
});

gordonrbrts
30 Oct 2018, 8:35 AM
I have a similar issue. I am passing metadata back from a store.load() function with a column config object. The columns all render correctly, with the proper information in them, except for the alignment. I'm trying to center a string in this column, and it aligns to the default (left).

The interesting thing is that if I refresh the grid, or page, then the alignment snaps to center. I would like that alignment to be centered after the initial load.