PDA

View Full Version : Store not found with ViewPort in MasterPage



jchau
Oct 15, 2008, 8:15 PM
I have a masterpage with a viewport and content page with borderlayout. In the content page, I also have a store outside the borderlayout and a grid inside the borderlayout. When the page loads, JS error saying store not defined. This is because the store is created AFTER the borderlayout is created. If I move the store to my masterpage and place it outside the viewport, it's fine. However, the store is unique to the content page and should not be in masterpage. My only alternative right now is to add another contentplaceholder outside the viewport and put the store there. Just wondering if there's a better solution.

Please also tell me if all this Viewport-->BorderLayout-->Panel-->BorderLayout-->More Content is inefficient. I can't find another way to have my contentform resize correctly. This is a VERY simplified version of my production code. In production, the masterpage's borderlayout contains a North and South region so having a borderlayout is necessary but I am not sure how to get rid of the Panel-->BorderLayout in the contentform. I tried using a FitLayout but that didn't work.

MasterPage


<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server">
</ext:ScriptManager>

<ext:ViewPort runat="server">
<Content>
<ext:BorderLayout runat="server">
<Center MarginsSummary="5">
<ext:Panel runat="server" Border="false">
<Content>
<asp:ContentPlaceHolder runat="server" ID="c">
</asp:ContentPlaceHolder>
</Content>
</ext:Panel>
</Center>
</ext:BorderLayout>
</Content>
</ext:ViewPort>
</form>
</body>
</html>


ContentPage


<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="c" runat="server">
<ext:Store ID="storeSuppliers" runat="server">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="CompanyName">
</ext:RecordField>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:BorderLayout runat="server">
<Center>
<ext:GridPanel runat="server" ID="gridSuppliers" StoreID="storeSuppliers">
<ColumnModel runat="server">
<Columns>
<ext:Column DataIndex="CompanyName" Header="Company Name">
</ext:Column>
</Columns>
</ColumnModel>
</ext:GridPanel>
</Center>
</ext:BorderLayout>
</asp:Content>

Vladimir
Oct 16, 2008, 6:28 AM
Hi,

Any Layout must be sole control in Content area. The Store must defined above any controls which used this Store. I think your solution with additional ContentPlaceholder is good

geoffrey.mcgill
Oct 17, 2008, 6:58 AM
Please also tell me if all this Viewport-->BorderLayout-->Panel-->BorderLayout-->More Content is inefficient.

That layout configuration is not a problem and will be rendered very efficiently. I've built Panel-->Layout samples with 10+ levels deep and did not notice any performance issues.

I'm also running some tests with your code sample and I think we should be able to tweak the Layout logic to make this scenario work.

jchau
Nov 03, 2008, 2:35 PM
I just ran into a similar issue with a parent page/usercontrol with the following setup:

Page--> Viewport --> BorderLayout --> Center --> Panel --> UserControl --> Store, GridPanel

Unfortunately, I can't apply the workaround with MasterPage's contentplaceholder. Any thoughts?