Apr 25, 2012, 11:12 AM
Problem with Nested Data , Unable to get value of the property 'internalId' Error
Hi
When i use nested 'Items ' in my store i see this error:
"Microsoft JScript runtime error: Unable to get value of the property 'internalId': object is null or undefined ."
But when i remove Items from my modelfield collection , everything working good .
I need to show my nested data in dashboard . Is there any bug here ?
This Code Returns "Microsoft JScript runtime error: Unable to get value of the property 'internalId': object is null or undefined ." Error at runtime .
Model Class :
and Dashboard Controller :
Is There any Idea ?
Please Help me .
When i use nested 'Items ' in my store i see this error:
"Microsoft JScript runtime error: Unable to get value of the property 'internalId': object is null or undefined ."
But when i remove Items from my modelfield collection , everything working good .
I need to show my nested data in dashboard . Is there any bug here ?
This Code Returns "Microsoft JScript runtime error: Unable to get value of the property 'internalId': object is null or undefined ." Error at runtime .
<ext:DataView ID="DashboardView" IDMode="Static" runat="server" SingleSelect="true" OverClass="x-view-over"
ItemSelector="div.item-wrap" AutoHeight="true" EmptyText="There is No Data">
<Store>
<ext:Store ID="Store1" runat="server" AutoLoad="true">
<Proxy>
<ext:AjaxProxy Url="/Data/GetDashBoard" Json="true" BatchActions="False">
<Reader>
<ext:JsonReader Root="data" TotalProperty="total" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model ID="Model1" runat="server" >
<Fields>
<ext:ModelField Name="Title" />
<ext:ModelField Name="Target" />
<ext:ModelField Name="AccordionID" />
<ext:ModelField Name="MenuItemID" />
<ext:ModelField Name="Icon" />
<ext:ModelField Name="StyleClass" />
<ext:ModelField Name="Notes" />
<ext:ModelField Name="Items" IsComplex="true" />
</Fields>
</ext:Model>
</Model>
<%-- <AutoLoadParams>
<ext:StoreParameter Name="dashboardID" Value='<%# ViewBag.DashboardDataID %>' Mode="Value"
AutoDataBind="true" />
<ext:StoreParameter Name="dashboardSubID" Value='<%# ViewBag.DashboardDataSubID %>'
Mode="Value" AutoDataBind="true" />
<ext:StoreParameter Name="recentActivitiesIsVisible" Value='<%# ViewBag.DashboardRecentActivitesIsVisible %>'
Mode="Value" AutoDataBind="true" />
<ext:StoreParameter Name="favoriteActivitiesIsVisible" Value='<%# ViewBag.DashboardFavoriteActivitesIsVisible %>'
Mode="Value" AutoDataBind="true" />
</AutoLoadParams>--%>
<Parameters>
<ext:StoreParameter Name="dashboardID" Value='<%# ViewBag.DashboardDataID %>' Mode="Value"
AutoDataBind="true" />
<ext:StoreParameter Name="dashboardSubID" Value='<%# ViewBag.DashboardDataSubID %>'
Mode="Value" AutoDataBind="true" />
<ext:StoreParameter Name="recentActivitiesIsVisible" Value='<%# ViewBag.DashboardRecentActivitesIsVisible %>'
Mode="Value" AutoDataBind="true" />
<ext:StoreParameter Name="favoriteActivitiesIsVisible" Value='<%# ViewBag.DashboardFavoriteActivitesIsVisible %>'
Mode="Value" AutoDataBind="true" />
</Parameters>
</ext:Store>
</Store>
<Tpl runat="server">
<Html>
<div id="items-ct">
<tpl for=".">
<div class="group-header">
<h2><div><img style="margin : 1px 10px 1px 10px;height:40px;width:40px ;" src="{Icon}"/>{Title}</div></h2>
<dl>
<tpl for="Items">
<div class="item-wrap" ext:panel="{AccordionID}" ext:menu="{MenuItemID}">
<img src="{Icon}"/>
<div>
<H6>{Title}</H6>
</div>
</div>
</tpl>
<div style="clear:right"></div>
</dl>
</div>
</tpl>
</div>
</Html>
</Tpl>
<Listeners>
<SelectionChange Fn="selectionChanged" />
<ItemClick Fn="itemClick" />
</Listeners>
</ext:DataView>
Model Class :
private class NavigationItem
{
public string Title { get; set; }
public string Target { get; set; }
public string AccordionID { get; set; }
public string MenuItemID { get; set; }
public string Icon { get; set; }
public string StyleClass { get; set; }
public string Notes { get; set; }
public IEnumerable<NavigationItem> Items { get; set; }
}
and Dashboard Controller :
public StoreResult GetDashBoard(string dashboardID, string dashboardSubID, bool recentActivitiesIsVisible, bool favoriteActivitiesIsVisible)
{
// StoreResult ajr = new StoreResult();
List<NavigationItem> mlist;
if (string.IsNullOrEmpty(dashboardID) || dashboardID == "Home")
{
mlist = new List<NavigationItem>(GetNavigationData());
}
else
{
if (string.IsNullOrEmpty(dashboardSubID))
{
var query = from xx in GetNavigationData()
where xx.AccordionID == "aci_" + dashboardID
select xx;
mlist = new List<NavigationItem>(query);
}
var querym = from xx in GetNavigationData().FirstOrDefault(vv => vv.AccordionID == "aci_" + dashboardID).Items
where xx.MenuItemID == "mni_" + dashboardSubID
select xx;
mlist = new List<NavigationItem>(querym);
}
if (recentActivitiesIsVisible)
{
NavigationItem mrecent = new NavigationItem()
{
Title = "Recent",
AccordionID = "aci_recent",
Icon = "/Resources/Images/AppIcon/book_open.png",
Items = GetRecentActivities()
};
mlist.Insert(0, mrecent);
}
if (favoriteActivitiesIsVisible)
{
NavigationItem museful = new NavigationItem()
{
Title = "Facorites",
AccordionID = "aci_useful",
Icon = "/Resources/Images/AppIcon/favorite.png",
Items = GetUsefulActivities()
};
mlist.Insert(1, museful);
}
return new StoreResult(mlist);
}
and when i Remove Items from my modelfield , everything working good . Is There any Idea ?
Please Help me .
Last edited by sa_tabrizi; Apr 25, 2012 at 11:29 AM.
Reason: Add Some Code