Problem with Nested Data , Unable to get value of the property 'internalId' Error

  1. #1

    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 .
    
       <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
  2. #2

    Problem with IsComplex="true"

    Hi, I have an aspx page that worked fine in version 1.x. When I moved the application to v2, I had an issue with
    the dataview that I tracked down to the (ext:ModelField Name="Items" IsComplex="true") as shown below. I know
    that I am not supposed to used it with a JasonReader but the code perfectly in v1.x.

    The oridinal code looked like this in V1.x:
    [CODE]
    <ext:Store runat="server" ID="Store1" AutoLoad="true">
    <Proxy>
    <ext:HttpProxy Url="/Data/GetHomeSchema/" />
    </Proxy>
    <Reader>
    <ext:JsonReader Root="data">
    <Fields>
    <ext:RecordField Name="Title" />
    <ext:RecordField Name="Items" />
    </Fields>
    </ext:JsonReader>
    </Reader>
    </ext:Store>

    <ext:Panel ID="DashBoardPanel" runat="server" Cls="items-view" AutoHeight="true" Border="false">
    <Items>
    <ext:DataView ID="DataView1"
    runat="server"
    StoreID="Store1"
    SingleSelect="true"
    OverClass="x-view-over"
    ItemSelector="div.item-wrap"
    AutoHeight="true"
    EmptyText="No items to display"
    Layout="Fit">
    <Template ID="Template1" runat="server">
    <Html>
    <div id="items-ct">
    <tpl for=".">
    <div>
    <h2><div>{Title}</div></h2>
    <dl>
    <tpl for="Items">
    <div class="item-wrap" ext:panel="{Accordion}" ext:menu="{MenuItem}">
    <img src="{itemIcon}"/>
    <div>
    <H6>{Title}</H6>
    </div>
    </div>
    </tpl>
    <div style="clear:left"></div>
    </dl>
    </div>
    </tpl>
    </div>
    </Html>
    </Template>
    <Listeners>
    <SelectionChange Fn="selectionChanged" />
    <ContainerClick Fn="viewClick" />
    </Listeners>
    </ext:DataView>
    </Items>
    </ext:Panel>
    [CODE]

    The current code is as follows in v2.x:

    [CODE]
    <ext:Store runat="server" ID="DashBoardStore" AutoLoad="true">
    <Proxy>
    <ext:AjaxProxy Url="/Data/GetHomeSchema/" >
    <Reader>
    <ext:JasonReader Record="Title" />
    </Reader>
    </ext:AjaxProxy>
    </Proxy>
    <Model>
    <ext:Model runat="server">
    <Fields>
    <ext:ModelField Name="Title" />
    <ext:ModelField Name="Items" IsComplex="true" />
    </Fields>
    </ext:Model>
    </Model>
    </ext:Store>

    <ext:Panel ID="DashBoardPanel" runat="server" Cls="items-view" AutoHeight="true" Border="false" Layout="FitLayout">
    <Items>
    <ext:DataView
    ID="DataView1"
    runat="server"
    StoreID="DashBoardStore"
    OverCls="x-view-over"
    ItemSelector="div.item-wrap"
    SingleSelect="true"
    AutoHeight="true"
    EmptyText="No items to display">
    <Tpl ID="Template1" runat="server">
    <Html>
    <div id="items-ct">
    <tpl for=".">
    <div class="group-header">
    <h2><div>{Title}</div></h2>
    <dl>
    <tpl for="Items">
    <div class="item-wrap" ext:panel="{Accordion}" ext:menu="{MenuItem}">
    <img src="{itemIcon}"/>
    <div>
    <H6>{Title}</H6>
    </div>
    </div>
    </tpl>
    <div style="clear:left"></div>
    </dl>
    </div>
    </tpl>
    </div>
    </Html>
    </Tpl>
    <Listeners>
    <SelectionChange Fn="selectionChanged" />
    <ContainerClick Fn="viewClick" />
    </Listeners>
    </ext:DataView>
    </Items>
    </ext:Panel>
    [CODE]

    The Items portion doesn't work with the JasonReader in V2 but did work with the JasonReader with v1.x.
    If you use it, it will give you the internalid error. I have checked the data that is returned and it looks correct with respect the what the
    Url method returns. The <Tpl> tag gives the internalid error when it tries to display the data. Your example for the grouping sample does not use a
    IsComplex attribute. This is the reason it works. If I comment the IsComplex field, the dataview works properly. The problem is with children of the items field.
  3. #3

Similar Threads

  1. [CLOSED] Nested data in nested grids
    By FAS in forum 1.x Legacy Premium Help
    Replies: 16
    Last Post: Apr 19, 2012, 7:51 PM
  2. Replies: 3
    Last Post: Apr 05, 2012, 10:55 AM
  3. Replies: 1
    Last Post: Jan 06, 2012, 6:04 PM
  4. [CLOSED] Filtering a store with nested data
    By jchau in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 13, 2011, 1:27 PM
  5. Replies: 1
    Last Post: Feb 22, 2011, 11:25 PM

Tags for this Thread

Posting Permissions