Feb 11, 2013, 5:42 PM
RowExpander Subdata Loader Problem
In the following UserControl my main data is loading but when I click an expander(the plus) the Loader mask just says loading and nothing happens beyond this point. Here is my code below that is not working. Notice it's nested in windows, modules and DesktopModuleProxies. The nesting is where I suspect the problem is.
Now when I copy the guts into a plain .aspx page it works as expected. Note that the only difference is the commented out ViewRelation stuff. Here is that code.
<%@ Control Language="C#" %>
<%@ Import Namespace="System.Collections.Generic"%>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (X.IsAjaxRequest)
{
//We do not need to DataBind on an DirectEvent
return;
}
List<object> data = new List<object>();
for (int i = 1; i <= 10; i++)
{
data.Add(new { ID = "S" + i, Name = "Supplier " + i});
}
this.Store1.DataSource = data;
this.Store1.DataBind();
}
[DirectMethod]
public static string GetGrid(Dictionary<string, string> parameters)
{
// string id = parameters["id"];
List<object> data = new List<object>();
for (int i = 1; i <= 10; i++)
{
data.Add(new { ID = "P" + i, Name = "Product " + i });
}
GridPanel grid = new GridPanel
{
Height = 200,
EnableColumnHide = false,
Store =
{
new Store
{
Model = {
new Model {
IDProperty = "ID",
Fields =
{
new ModelField("ID"),
new ModelField("Name")
}
}
},
DataSource = data
}
},
ColumnModel =
{
Columns =
{
new Column { Text = "Products's Name", DataIndex = "Name" }
}
}
};
return ComponentLoader.ToConfig(grid);
}
</script>
<ext:DesktopModuleProxy ID="DesktopModuleProxy1" runat="server">
<Module ModuleID="Enterprise-View-win">
<Shortcut Name="Enterprise View" IconCls="x-grid-shortcut" SortIndex="4" />
<Launcher Text="Enterprise View" Icon="Table" />
<Window>
<ext:Window ID="winEnterpriseView" runat="server"
Icon="Table"
Width="740"
Height="480"
AnimCollapse="false"
ConstrainHeader="true"
Layout="Fit"
Title="Enterprise View">
<Items>
<ext:GridPanel
runat="server"
Title="Expander Rows with GridPanel"
Collapsible="true"
AnimCollapse="true"
Icon="Table"
Width="600"
Height="450"
DisableSelection="true">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model runat="server" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Supplier" DataIndex="Name" Flex="1" />
</Columns>
</ColumnModel>
<Plugins>
<ext:RowExpander runat="server">
<Loader runat="server" DirectMethod="#{DirectMethods}.GetGrid" Mode="Component">
<LoadMask ShowMask="true" />
<Params>
<ext:Parameter Name="id" Value="this.record.getId()" Mode="Raw" />
</Params>
</Loader>
</ext:RowExpander>
</Plugins>
</ext:GridPanel>
</Items>
</ext:Window>
</Window>
</Module>
</ext:DesktopModuleProxy>
The script and markup above should go inside a user control and then add that control to an aspx page. The code below should be placed directly into an aspx page.Now when I copy the guts into a plain .aspx page it works as expected. Note that the only difference is the commented out ViewRelation stuff. Here is that code.
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic"%>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (X.IsAjaxRequest)
{
//We do not need to DataBind on an DirectEvent
return;
}
List<object> data = new List<object>();
for (int i = 1; i <= 10; i++)
{
data.Add(new { ID = "S" + i, Name = "Supplier " + i});
}
this.Store1.DataSource = data;
this.Store1.DataBind();
}
[DirectMethod]
public static string GetGrid(Dictionary<string, string> parameters)
{
// string id = parameters["id"];
List<object> data = new List<object>();
for (int i = 1; i <= 10; i++)
{
data.Add(new { ID = "P" + i, Name = "Product " + i });
}
GridPanel grid = new GridPanel
{
Height = 200,
EnableColumnHide = false,
Store =
{
new Store
{
Model = {
new Model {
IDProperty = "ID",
Fields =
{
new ModelField("ID"),
new ModelField("Name")
}
}
},
DataSource = data
}
},
ColumnModel =
{
Columns =
{
new Column { Text = "Products's Name", DataIndex = "Name" }
}
}
};
return ComponentLoader.ToConfig(grid);
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>RowExpander with GridPanel - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel
runat="server"
Title="Expander Rows with GridPanel"
Collapsible="true"
AnimCollapse="true"
Icon="Table"
Width="600"
Height="450"
DisableSelection="true">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model runat="server" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Supplier" DataIndex="Name" Flex="1" />
</Columns>
</ColumnModel>
<Plugins>
<ext:RowExpander runat="server">
<Loader runat="server" DirectMethod="#{DirectMethods}.GetGrid" Mode="Component">
<LoadMask ShowMask="true" />
<Params>
<ext:Parameter Name="id" Value="this.record.getId()" Mode="Raw" />
</Params>
</Loader>
</ext:RowExpander>
</Plugins>
</ext:GridPanel>
</form>
</body>
</html>
Please help.
Last edited by thewisegod; Feb 13, 2013 at 12:40 PM.