Apr 19, 2012, 6:50 PM
Fit Layout not being applied to GridPanel on collapsed Panel/Tab
Hi,
I have a page with a ViewPort and 4 regions on it. The east region is collapsed by default and has a TabPanel on it with a GridPanel on each tab. Here?s the definition:
However, if I resize the panel using the slider, it will then be applied afterwards:
My hacky workaround for now has been to add a listener to the expand event for the Panel, and then call GridPanelStaffStats.getView().refresh(); in the handler which also seems to apply the layout. Unfortunately when the panel is previewed (clicking the side bar, and not the expand button) that does not trigger the expand event (not sure which event is called for that) and so if the user does that they won?t be able to see the grid correctly.
The data for this GridPanel is provided by a stored procedure and as such is loaded in the code behind on page load:
Is this a bug? Or am I missing something?
Thanks,
-Travis
I have a page with a ViewPort and 4 regions on it. The east region is collapsed by default and has a TabPanel on it with a GridPanel on each tab. Here?s the definition:
<ext:Panel ID="PanelStats" runat="server" Collapsible="true" Collapsed="true" Region="East"
Split="true" Title="Stats" Width="500" Layout="FitLayout" >
<Listeners>
<Expand Handler="statsPanelShow();" />
</Listeners>
<Items>
<ext:TabPanel ID="TabPanelInfo" runat="server" TabPosition="Top" Title="InformationTabs" ActiveTabIndex="0" >
<Items>
<ext:Panel ID="PanelStaffStats" runat="server" Title="Staff Stats" Layout="FitLayout" >
<Items>
<ext:GridPanel ID="GridPanelStaffStats" runat="server" Cls="staffStatsGrid" TrackMouseOver="true" AutoExpandColumn="Staff_Name" >
<Store>
<ext:Store ID="StoreStaffStats" runat="server">
<Reader>
<ext:JsonReader IDProperty="SID" >
<Fields>
<ext:RecordField Name="SID" Type="Int" />
<ext:RecordField Name="Staff_Name" Type="String" />
<ext:RecordField Name="Staff_Name_Anon" Type="String" />
<ext:RecordField Name="VacUsed" Type="Int" />
<ext:RecordField Name="EDOUsed" Type="Int" />
<ext:RecordField Name="SickUsed" Type="Int" />
<ext:RecordField Name="VacRemaining" Type="Int" />
<ext:RecordField Name="EDORemaining" Type="Int" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModelStaffStats" runat="server" >
<Columns>
<ext:Column DataIndex="Staff_Name" Header="Staff Name" MenuDisabled="true">
<Renderer Fn="StaffStatsNameRender"/>
</ext:Column>
<ext:Column DataIndex="Staff_Name_Anon" Header="Staff Name" MenuDisabled="true" >
<Renderer Fn="StaffStatsNameRender"/>
</ext:Column>
<ext:Column DataIndex="VacUsed" Header="Vac Used" Width="65" MenuDisabled="true" >
<Renderer Fn="StaffStatsNameRender"/>
</ext:Column>
<ext:Column DataIndex="EDOUsed" Header="EDO Used" Width="65" MenuDisabled="true" >
<Renderer Fn="StaffStatsNameRender"/>
</ext:Column>
<ext:Column DataIndex="SickUsed" Header="Sick Used" Width="65" MenuDisabled="true" >
<Renderer Fn="StaffStatsNameRender"/>
</ext:Column>
<ext:Column DataIndex="VacRemaining" Header="Vac Balance" Width="65" MenuDisabled="true" >
<Renderer Fn="StaffStatsNameRender"/>
</ext:Column>
<ext:Column DataIndex="EDORemaining" Header="EDO Balance" Width="65" MenuDisabled="true" >
<Renderer Fn="StaffStatsNameRender"/>
</ext:Column>
</Columns>
</ColumnModel>
<View>
<ext:BufferView ID="BufferViewStaffStats" runat="server" RowHeight="15" />
</View>
</ext:GridPanel>
</Items>
</ext:Panel>
?
</ext:TabPanel>
</Items>
</ext:Panel>
The problem is that when I first expand the panel, PanelStaffStats does not have it?s FitLayout applied to it:However, if I resize the panel using the slider, it will then be applied afterwards:
My hacky workaround for now has been to add a listener to the expand event for the Panel, and then call GridPanelStaffStats.getView().refresh(); in the handler which also seems to apply the layout. Unfortunately when the panel is previewed (clicking the side bar, and not the expand button) that does not trigger the expand event (not sure which event is called for that) and so if the user does that they won?t be able to see the grid correctly.
The data for this GridPanel is provided by a stored procedure and as such is loaded in the code behind on page load:
//get the store
Store storeStaffStats = this.StoreStaffStats;
//store parameters
Hashtable parameters = new Hashtable();
//pass in the current date for the schedule
parameters.Add("@active", true); //only get active staff
parameters.Add("@IsRT", true);
DataTable procResults = GetDataTableFromSP("Proc_VacEDOStats", parameters);
storeStaffStats.DataSource = procResults;
storeStaffStats.DataBind();
Adding gridStaffStats.GetView().Refresh(); to the code behind did not seem to have any effect either.Is this a bug? Or am I missing something?
Thanks,
-Travis