Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
785
Reg: Need help on Infragistics WebDataTree Node Properties & methods
posted

HI,

 Previous we used UltraWebTree for that we used below properties & functions in our project. Now we are Migrating UltrsWebTree to WebDataTree. Please let me know Alternate of below properties & Functions supporting to WebDataTree

we used for UltraWebTree properties & functions like igtree_getNodeById, node.getDataKey, igtree_getTreeById

function UltraWebTreeResourceFolders_AfterNodeSelectionChange()
    {                                                          
        var selectedNode = tree.getSelectedNode();
        var folderKey = selectedNode.getDataKey();
                  
             // Logic


            selectedNode.scrollIntoView(false);             
        }
    }

 var childkey = childNode.getDataKey();
 if(dataKey == childkey)
   {                    
         if(!childNode.getExpanded())
       {
           childNode.setExpanded(true);
         }                    
         childNode.set_Selected(true);                                            
           childNode.scrollIntoView(false);
           return;
      }

Thanks in advance

Thanks & Regards

Ram

Parents
  • 10685
    Suggested Answer
    Offline posted

    Hello,

    In case of migration, I recommend you to review the API documentation for the newer WebDataTree to learn more about the control:http://help.infragistics.com/doc/ASPNET?page=Web_WebDataTree.html
    This will ensure you will get to know the new control faster. I believe once familiar with the existing API, it will be easier to achieve a similar functionality.
     

    igtree_getTreeById - You could find the WebDataTree at the client using the AJAX $find method.
    You could use one of the following approaches, in order to access the WebDataTree with specific ID’s at the client side:
    var tree = $find("<%=this. WebDataTree1.ClientID%>"); 

    And in case you have ensured the use of static id for the WebDataTree when initialized on the server (like WebDataTree1.ClientIDMode = System.Web.UI.ClientIDMode.Static;), you could use the following client side syntax as well: var tree = $find("WebDataTree1")
    In general, by defining 'ClientIDMode' as static you are saying that your 'ClinetID' and 'ServerID' will have the same values.     

    igtree_getNodeById – No exact equivalent is existing. You could use the node address to achieve similar functionality. Details here
    Additionally it is possible to navigate to a specific node like using getNode function.
    $find("WebDataTree1").getNode(1) 

    node.getDataKey - You could use DataItem or the Key property of WebDataTree nodes. 

    Since it is not possible to connect each existing property to a new equivalent, I suggest you to look at the shared resources. During the migration you may also want to search through the forum for similar issues as many others have already faced similar issues. 

    You may also benefit from the following resources:

    WebDataTree Official Doc Section
    WebDataTreeDocumentation
    WebDataTree ClientSide Library
    WebDataTree Namespace
    Node class Members
    Online Samples
    WebDataTree FAQ

Reply Children
  • 10685
    Suggested Answer
    Offline posted in reply to ramya y

    Hello,
    There are several methods and properties you could use. For example
    FindNodeByKey, AllNodes, Key

    The FindNodeByKey method will return the node on the specific Nodes collection on which you’ve called the method. In order to find a specific node based on its key in the complete list of nodes in the tree you can use the AllNodes property which will return an array list with all nodes in the tree in depth-first order. You can loop in that collection and check the related Key of each node.

    AllNodes - Returns an ArrayList consisting of the complete list of nodes in the tree in depth-first order.

    For example:
    ArrayList nodesList = WebDataTree1.AllNodes;
        for(int i=0; i<nodesList.Count; i++)
        {
            if (((Infragistics.Web.UI.NavigationControls.NavItem)(nodesList[i])).Key == "ChildNode1.2")
                {
                //your code here
                } 

    DataTreeNode Class Members à

    Key - Set or gets a string value that can be used to uniquely identify a node, independent of its Text or Value properties. The Key property can be bound to a DataSource field using the NodeBinding.KeyField property setting. (Inherited from Infragistics.Web.UI.NavigationControls.NavItem)

    DataItem - Sets or gets an object value that contains a reference to the object in the data source that supplied the data for this item. (Inherited from Infragistics.Web.UI.Framework.CollectionUIObject)

    FindNodeByKey- Finds the node with the specified key if such exists, null otherwise.