[CLOSED] Component inside RowExpander no longer has Id in App namespace
Hi,
Getting latest code of 2.1 I am now finding that if I have a component inside a row expander I no longer have access to that component's Id.
For example, I was able to do this just before the row expander code was updated:
Code:
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store1.DataSource = new object[]
{
new object[] { "3m Co", "3M" },
new object[] { "Alcoa Inc", "ALOA" },
new object[] { "Altria Group Inc", "ALT" },
new object[] { "American Express Company", "AMX" }
};
Store1.DataBind();
}
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Simple Grid - Ext.NET Examples</title>
<style type="text/css">
body { padding:10px; }
.positive { color: green; }
.negative { color: red; }
.company-details { margin:3px; padding:3px; border:1px solid #ccc; background:#fff; }
.perf { float: right; width: 170px; padding:5px; }
</style>
<script type="text/javascript">
var onExpand = function(symbol, nestedGrid) {
// nested grid seems to be empty - App.NestedGrid is not defined
console.log(symbol, nestedGrid);
};
</script>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" Title="Simple Grid" Height="310" Width="500">
<Store>
<ext:Store ID="Store1" runat="server" PageSize="10">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="Company" />
<ext:ModelField Name="Symbol" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column Text="Company" DataIndex="Company" Flex="1" />
</Columns>
</ColumnModel>
<Plugins>
<ext:RowExpander runat="server" SingleExpand="false">
<Listeners>
<Expand Handler="onExpand(record.data.Symbol, #{NestedGrid});" />
</Listeners>
<Component>
<ext:GridPanel Id="NestedGrid" runat="server" Title="Monthly Average" Height="150" Padding="10">
<Store>
<ext:Store>
<Model>
<ext:Model>
<Fields>
<ext:ModelField Name="Price" Type="Float" />
<ext:ModelField Name="PercentChange" Type="Float" />
<ext:ModelField Name="Date" Type="Date" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:DateColumn Text="Last Updated" DataIndex="Date" Format="MM-yyyy" />
<ext:Column Text="Price" DataIndex="Price" Width="50" />
<ext:Column Text="Change" DataIndex="PercentChange" Width="50" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</Component>
</ext:RowExpander>
</Plugins>
<BottomBar>
<ext:PagingToolbar runat="server" />
</BottomBar>
</ext:GridPanel>
</body>
</html>
Notice the bit of JavaScript to handle onExpand:
Code:
var onExpand = function(symbol, nestedGrid) {
// nested grid seems to be empty - App.NestedGrid is not defined
console.log(symbol, nestedGrid);
};
nestedGrid is null. When I look at the View Source, the Ext.NET initialization script has this bit:
Code:
{expand:{fn:function(item,record,body,row,rowIndex){onExpand(record.data.Symbol, App.NestedGrid);}}
When I type App.NestedGrid into Firebug or a console, it is not defined.
Does this approach no longer work with the changes to RowExpander, or is it just something that accidentally slipped through? The code I have is cut down but the original was quite nice - in the onExpand handler I was calling a DirectMethod or web service in the past to get some raw data which I could then load the store with.
Thanks!