cancel NodePopulating?

3 posts, 0 answers
  1. Andrew Johns
    Andrew Johns avatar
    10 posts
    Member since:
    Jul 2009

    Posted 08 Jul 2009 Link to this post

    not even sure I want to actually cancel the nodepopulating event yet, but I'll explain what I'm attempting:

    I have a radtreeview, with it's nodes being populated by a webservice when expanded.  As it turns out, one of the nodes has a LOT of children, and even taking into consideration an extra level of nodes, to perhaps break the subnodes down by alphabetical order, it doesn't look like the most usable way of selecting nodes under that category, not to mention very slow to return so many nodes.

    So, what was considered is something along the lines of canceling the particular nodePopulating event (although I guess the better approach is to change the TreeNodeExpandMode for that node in the first place - I think I just answered my own question), and instead of loading the nodes instantly, display a textbox, where the user can start typing the first letters of the required child node, at which point the nodes under that category will filter based on the user's text entry.  I can imagine this being an ajax style predictive text box, but perhaps this isn't that important - the key thing is not actually populating children for this node until the user has entered some text into a textbox to filter the list.

    Sound possible?
  2. Andrew Johns
    Andrew Johns avatar
    10 posts
    Member since:
    Jul 2009

    Posted 08 Jul 2009 Link to this post

    Ok, what I've managed to do so far is modify my nodePopulating function, so that if a particular  condition is met, the node becomes a client side rather than WebService expand mode.

    function nodePopulating(sender, eventArgs) {

        var node = eventArgs.get_node();
        var context = eventArgs.get_context();      

        nodevalue = node.get_value().split("|");
        context["tagType"] = nodevalue[0];
        context["tagID"] = nodevalue[1];

        if (context["tagType"] == "ATagType") {
            var newnode = new Telerik.Web.UI.RadTreeNode();

    Which creates a new node on the fly, with text "test".  My question now is: This page ( suggests it's possible to put a textbox into a node, albeit this example is server side.  Can it be done using javascript, or do I abandon this now and switch to doing it using a server side postback when this node is clicked, and then populate the textbox that way?

    The end result is that the textbox (and "go" button) will then attempt to retrieve child nodes based on the search criteria, using the original webservice I set up originally.
  3. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 09 Jul 2009 Link to this post

    Hi Andrew Johns,

    You can inject arbitrary html in the node element, however it would disappear after postback. Anyway here is some sample code to get you started:

    var input = document.createElement("input")

    var node = $find("tv1").get_nodes().getNode(0);

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top