Store not found with ViewPort in MasterPage
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
Code:
<%@ 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
Code:
<%@ 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>
RE: Store not found with ViewPort in MasterPage
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
RE: Store not found with ViewPort in MasterPage
Quote:
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.
RE: Store not found with ViewPort in MasterPage
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?