skirtle
24 Oct 2011, 10:30 PM
invalidateScroller and determineScrollbars both seem to have been removed. Given these methods were both documented in 4.0 I would suggest it is not appropriate to just remove them from 4.1. If they no longer make sense they should be marked as deprecated and given implementations that simply log a warning in debug mode.
I've removed them from my code and I wanted to check that my new solution is the 'correct' way to do it for 4.1. My use case is a little complicated so I've produced a much simplified version. The problem occurs when a grid row changes height after it has been rendered:
.x-grid-row-selected {
height: 400px;
}
var grid = Ext.create('Ext.grid.Panel', {
height: 300,
renderTo: Ext.getBody(),
width: 300,
columns: [{
dataIndex: 'name',
flex: 1,
text: 'Name'
}],
listeners: {
select: function() {
grid.invalidateScroller();
grid.determineScrollbars();
}
},
store: {
data: [{name: 'Ed'}],
fields: ['name']
}
});
In this example, selecting a row will make it much taller due to the CSS, such that the grid needs a vertical scrollbar when it didn't initially. In 4.1-pr1 I've had to change my select listener to:
select: function() {
grid.doLayout();
}
So far this appears to work fine. Without the call to doLayout() I also get a horizontal scrollbar, which I don't want.
I notice that the official RowExpander demo suffers from a similar problem if you trim the data down such that it initially doesn't have a vertical scrollbar.
I've removed them from my code and I wanted to check that my new solution is the 'correct' way to do it for 4.1. My use case is a little complicated so I've produced a much simplified version. The problem occurs when a grid row changes height after it has been rendered:
.x-grid-row-selected {
height: 400px;
}
var grid = Ext.create('Ext.grid.Panel', {
height: 300,
renderTo: Ext.getBody(),
width: 300,
columns: [{
dataIndex: 'name',
flex: 1,
text: 'Name'
}],
listeners: {
select: function() {
grid.invalidateScroller();
grid.determineScrollbars();
}
},
store: {
data: [{name: 'Ed'}],
fields: ['name']
}
});
In this example, selecting a row will make it much taller due to the CSS, such that the grid needs a vertical scrollbar when it didn't initially. In 4.1-pr1 I've had to change my select listener to:
select: function() {
grid.doLayout();
}
So far this appears to work fine. Without the call to doLayout() I also get a horizontal scrollbar, which I don't want.
I notice that the official RowExpander demo suffers from a similar problem if you trim the data down such that it initially doesn't have a vertical scrollbar.