[CLOSED] Problem with inherited treepanel and xmldatabinding

  1. #1

    [CLOSED] Problem with inherited treepanel and xmldatabinding

    Hi all,

    previously i used the static definition of treepanel (built in markup) and overrided the "OnInit" method of treepanel for iterate nodes and perform some actions based on custom attributes of nodes.
    Then i tested the new CustomAttributeBinding, but if i check the treepanel.Root property, the node collection is empty.
    Wich method i need to override to be sure that collection is filled?

    Thanks

    Best regards
    Last edited by Daniil; Jun 26, 2013 at 2:37 PM. Reason: [CLOSED]
  2. #2
    Hi @infonext,

    You can use a Store's DataBound event.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
    
        protected void TreeStore_DataBound(object sender, EventArgs e)
        {
            X.Msg.Alert("", (sender as TreeStore).Root[0].Text).Show();
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Xml File Loading - Ext.NET Examples</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <asp:XmlDataSource ID="XmlDataSource1" runat="server" 
                DataFile="authors.xml">
            </asp:XmlDataSource>
    
            <ext:TreePanel runat="server" Height="300" Width="250">
                <Store>
                    <ext:TreeStore runat="server" DataSourceID="XmlDataSource1" OnDataBound="TreeStore_DataBound">
                        <DataBindings>
                            <ext:NodeBinding DataMember="Authors" Text="Authors List" />
                            <ext:NodeBinding DataMember="Author" TextField="name" />
                            <ext:NodeBinding DataMember="blog" HrefField="url" TextField="url" Leaf="true" />
                        </DataBindings>
                    </ext:TreeStore>
                </Store>
            </ext:TreePanel>        
        </form>
    </body>
    </html>
    authors.xml
    <?xml version="1.0" encoding="utf-8" ?>
    <Authors>
      <Author name="Author 1">
        <blog url="http://ext.net/blogs/author1/" />
      </Author>
      <Author name="Author 2">
        <blog url="http://ext.net/blogs/author2/" />
      </Author>
      <Author name="Author 3">
        <blog url="http://ext.net/blogs/author3/" />
      </Author>
      <Author name="Author 4">
        <blog url="http://ext.net/blogs/author4/" />
      </Author>
    </Authors>
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @infonext,

    You can use a Store's DataBound event.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
    
        protected void TreeStore_DataBound(object sender, EventArgs e)
        {
            X.Msg.Alert("", (sender as TreeStore).Root[0].Text).Show();
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Xml File Loading - Ext.NET Examples</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <asp:XmlDataSource ID="XmlDataSource1" runat="server" 
                DataFile="authors.xml">
            </asp:XmlDataSource>
    
            <ext:TreePanel runat="server" Height="300" Width="250">
                <Store>
                    <ext:TreeStore runat="server" DataSourceID="XmlDataSource1" OnDataBound="TreeStore_DataBound">
                        <DataBindings>
                            <ext:NodeBinding DataMember="Authors" Text="Authors List" />
                            <ext:NodeBinding DataMember="Author" TextField="name" />
                            <ext:NodeBinding DataMember="blog" HrefField="url" TextField="url" Leaf="true" />
                        </DataBindings>
                    </ext:TreeStore>
                </Store>
            </ext:TreePanel>        
        </form>
    </body>
    </html>
    authors.xml
    <?xml version="1.0" encoding="utf-8" ?>
    <Authors>
      <Author name="Author 1">
        <blog url="http://ext.net/blogs/author1/" />
      </Author>
      <Author name="Author 2">
        <blog url="http://ext.net/blogs/author2/" />
      </Author>
      <Author name="Author 3">
        <blog url="http://ext.net/blogs/author3/" />
      </Author>
      <Author name="Author 4">
        <blog url="http://ext.net/blogs/author4/" />
      </Author>
    </Authors>
    Hi Daniil,
    now it works :)

    Thanks you!

    You can close discussion.
    Last edited by infonext; Jun 26, 2013 at 2:32 PM.

Similar Threads

  1. Replies: 2
    Last Post: May 14, 2013, 8:20 AM
  2. [CLOSED] Best Way to Extend a ComboBox inherited Control
    By sisa in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 11, 2013, 4:27 PM
  3. [CLOSED] How to add 2 userControl inherited by Ext.Net.Container?
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Sep 21, 2012, 10:11 AM
  4. [CLOSED] Register javascript resource to inherited control
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 11, 2010, 8:24 PM
  5. Replies: 3
    Last Post: Oct 07, 2009, 6:32 PM

Posting Permissions