I am creating an EXT form that uses several Panel
components, one of which collapses to the left. When it does so The Panel
on the right (called centrePanel, because although it's on the right it has a region of 'center') and its children expand. The immediate children of centrePanel
are Panel
s that have been set to scroll if the data on them cannot fit on the Panel
. The problem I am experiencing is that when I collapse the Panel
on the left, any scrollbars disappear. Expanding does not bring them back. However two things to note are:
- I can still scroll in both
Panel
s using my mouse. - After the collapsible
Panel
has been collapsed and expanded once and any scrollbars disappear, when the leftPanel
is subsequently collapsed the scrollbar on the other panels briefly becomes visible again. Once the collapse event has finished the scrollbars are no longer visible. This does not happen when thePanel
is expanded again.
Here is the relevant code.
Collapsible Panel
(declared on the fly as part of the items of the window):
region: "west",
width: "38%",
title: "Filter",
collapsible: true,
items: [myFilterFormPanel],
listeners:{
collapse: function(panel){
//Make centre panel and children wider when filter panel is collapsed.
centrePanel.setWidth(1000);
searchResultsPanel.setWidth(1000);
myColumnModel.setColumnWidth(0, 540);
myColumnModel.setColumnWidth(1, 165);
myColumnModel.setColumnWidth(2, 165);
},
expand: function(panel){
//Make centre panel and children wider when filter panel is collapsed.
centrePanel.setWidth(659);
searchResultsPanel.setWidth(659);
myColumnModel.setColumnWidth(0, 200);
myColumnModel.setColumnWidth(1, 90);
myColumnModel.setColumnWidth(2, 90);
}
}
myFilterFormPanel:
var myFilterFormPanel = new Ext.FormPanel({
border: false,
id: windowId + "myfilter",
items: [stationsPanel, datesPanel, daysPanel, impactPanel, searchButton]
});
centrePanel (contains panels that are scrollable but is not scrollable itself):
var centrePanel = new Ext.Panel({
border: false,
items: [searchResultsPanel, individualResultPanel]
}
});
searchResultsPanel (this becomes scrollable when necessary):
var searchResultsPanel = new Ext.grid.GridPanel({
title: "All Results",
id: windowId + "allresults",
region: "north",
height: 250,
border: false,
padding: 10,
autoScroll: true,
// style:'overflow-y:auto',
colModel: myColumnModel,
store: myStore,
listeners: {
rowclick: function(thisRow, rowIndex){
//Display additional information in individual result panel.
var myData = myStore.getAt(rowIndex).data;
individualResultPanel.body.update("<h1><u>Summary</u></h1><p>" + myData.summary + "</p>"
+ "<h1><u>Body</u></h1><p>" + myData.body + "</p>"
+ "<h1><u>Additional Information</u></h1><p>" + myData.additionalInformation + "</p>"
+ "<h1><u>Customer Information</u></h1><p>" + myData.customerInformation + "</p>"
+ "<h1><u>Further Information</u></h1><p>" + myData.furtherInformation + "</p>"");
}
}
});
individualResultPanel (also becomes scrollable);
var individualResultPanel = new Ext.Panel({
border: false,
autoScroll: true,
title: "Selected Result",
id: windowId + "individualresult",
region: "south",
height: 250,
padding: 10,
});
In the searchResultsPanel
I tried setting the style to be overflow:auto;
which is what setting autoScroll
to true
does anyway but this didn't change anything. I also tried reducing the width of one of the srollable Panel
s but this also made no difference. I thought about dynamically changing the style of the scrollable Panel
s when the collapsible Panel
is collapsed but given that I can always scroll, I don't think this will make a difference but correct me if I am wrong.