Dataview doesn't work properly for dashboard(grouping)

  1. #1

    Dataview doesn't work properly for dashboard(grouping)

    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:
     <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>
    The current code is as follows in v2.x:

     <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>
    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. 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. It cannot deal with nested children or Complex based field types. I tried the XmlReader but that didn't work either. I think that the problem can be reproduced if the AjaxProxy tag is used in your grouping sample as I show above.
    Last edited by geoffrey.mcgill; Sep 16, 2012 at 4:42 PM. Reason: please use [CODE] tags
  2. #2
    Please use CODE tags when you post a code
    Each data view items must correspond a real record but your ItemSelector uses a selector which returns items count > records
    Please investigate the following sample to understand how to change the code
    https://examples2.ext.net/#/DataView/Advanced/Grouping/
  3. #3

    IsComplex problem

    Quote Originally Posted by Vladimir View Post
    Please use CODE tags when you post a code
    Each data view items must correspond a real record but your ItemSelector uses a selector which returns items count > records
    Please investigate the following sample to understand how to change the code
    https://examples2.ext.net/#/DataView/Advanced/Grouping/
    Thank you.

    You were totally correct. The ItemSelector="div.group-header" solved the problem. My dashboard came up correctly.

Similar Threads

  1. Replies: 6
    Last Post: Oct 15, 2012, 6:20 AM
  2. Gridpanel doesn't resize properly
    By gdog_5021 in forum 1.x Help
    Replies: 10
    Last Post: Aug 18, 2011, 2:45 PM
  3. Replies: 27
    Last Post: May 17, 2011, 9:41 PM
  4. [CLOSED] spotlight doesn't work properly with window control
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 10, 2009, 2:43 PM
  5. Grouping in a DataView
    By Onur in forum 1.x Help
    Replies: 0
    Last Post: Oct 20, 2008, 8:04 PM

Posting Permissions