Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > TreeView > findNodeByText and fincNodeByValue are missing in MVC version !!

Not answered findNodeByText and fincNodeByValue are missing in MVC version !!

Feed from this thread
  • Martin avatar

    Posted on Oct 11, 2011 (permalink)

    these two methods are missing in the MVC version :(

    for how long are we supposed to hack the TreeView using jQuery selectors ???

    Reply

  • Posted on Oct 28, 2011 (permalink)

    Hi Martin,

    I have a CodePlex project (http://telerikmvcextendedjs.codeplex.com/) where I have been extended the client API for the Telerik MVC controls.  I came across your forum post last night and started implementing findNodeByText() and findNodeByValue() functions for the treeview.

    If you would be willing to give me feedback, I would like to work with you on implementing the same functionality that you see in the ASP.NET AJAX RadTreeView.

    I've attached a sample application for you to look at.  Run the application, and on the home page, under Samples, TreeView, click on "Working with Client Side Tree Node".  The findNodeByText() and findNodeByValue() return a "Node" object with the following functions implemented:
    1. select()
    2. deselect()
    3. selected()
    4. highlight()
    5. unhighlight()
    6. expand()
    7. collapse()

    Let me know what you think and what functions would be a priority for you.  I'll be adding more functions over the weekend.

    Regards,

    John DeVight
    telerikmvcextendedjs at gmail dot com
    Attached files

    Reply

  • Alex Gyoshev Alex Gyoshev avatar

    Posted on Nov 1, 2011 (permalink)

    Hi John, Martin,

    We just added the findByText() and findByValue() functions. They will be available with upcoming builds.

    Best wishes,
    Alex Gyoshev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

  • Posted on Nov 3, 2011 (permalink)

    Hi, John and Alex.

    The item WikiPage.cs is missing in the project...

    thank you

    Paulo

    Reply

  • Martin avatar

    Posted on Nov 3, 2011 (permalink)

    Hi John...

    sorry, haven't had the time to look at your solution.

    I hacked the MVC control using jQuery some time ago... i found most solutions and inspiration on this forum and via Google.
    So i already implemented lots of functions myself:
    - nodeByValue
    - expandNode
    - expandByNodeValue
    - parentNode

    and using cookies and Hashnavigation i've also created a 'persistent' tree that saves state between refresh, and ability to navigate to a node via a link ... http//..../?cat=5#node=15

    but in my mind, a lot of nice api's are missing in the MVC version... so i hope that MVC controls will get more attention in the near future, especially now where Microsoft is speeding up development of MVC 4-5-6...

    I'll have a look at your extensions as soon as i get time (or in the moment there is an API im missing) - i have a deadline im trying to catch :)

    I'll post comments and addon's when i get the time :)

    Reply

  • Posted on Nov 3, 2011 (permalink)

    Thanks Alex!

    Reply

  • Posted on Nov 3, 2011 (permalink)

    Hi Paulo,

    The WikiPage.cs should have been removed from the project.  My mistake!  Please try removing it from the project and if it is still causing problems, let me know...  I'll also update the project in the previous post.

    Regards,

    John

    Reply

  • Posted on Nov 3, 2011 (permalink)

    Hi Martin,

    I'd be very interested in the persisted tree solution.  I had a need for it as well and put together a solution that works, but is a bit of a hack.

    Feel free to contact me anytime about any API's that you find would be useful.  I'm always looking for ideas to add to my little CodePlex project... =)

    Regards,

    John DeVight
    telerikmvcextendedjs at gmail dot com

    Reply

  • Martin avatar

    Posted on Nov 7, 2011 (permalink)

    Hi John

    Just now i'm faced with a challenge : Deleting a node from the tree !

    this is how i use Hash navigation:
    http://benalman.com/projects/jquery-hashchange-plugin/

    var byScript = false;
    function onNodeSelected(e) {
        byScript = true;
        var nodeid = treeView().getItemValue(e.item);
        location.hash = "#node=" + nodeid; //<----- HashChange plugin
     
        getNodeContentByID(nodeid);
         
        expandNodeID(nodeid);
    }
    //Select a Node
    function ClickNode(nodeid) {
        $("#TreeView").find(".t-input[name='itemValue'][value='" + nodeid + "']")
                      .closest("div")
                      .find(".t-in:first")
                      .trigger("click");
         
        //expand parent in case its closed
        expandNodeID(parentNode(itemByValue(nodeid)));
        expandNodeID(nodeid);
    }
     
    $(function () {
        // Bind the event.
        $(window).hashchange(function () {
            if (!byScript) {
                if (location.hash.indexOf("#node=") > -1) {
                    ClickNode(location.hash.split("=")[1]);
                }
                /*else if ($.cookie('SelectedNode') != null) {
                    ClickNode($.cookie('SelectedNode'));
                } */
                else { //selecting using serverside scripting...
                    ClickNode(@(Model.CourseTree.Count > 0 ? Model.CourseTree.First().CourseTreeNodeID : 0));
                }
            }
            byScript = false;
        })
    });

    Reply

  • Martin avatar

    Posted on Nov 7, 2011 (permalink)

    And this is how i created the persistent tree:
    Require the Cookie plugin: http://plugins.jquery.com/project/Cookie


    function
    onNodeSelected(e) {
            var nodeid = treeView().getItemValue(e.item)
     
            $.cookie('SelectedNode', nodeid); //<-- require the jquery cookie plugin
     
            getNodeContentByID(nodeid);
            expandNodeID(nodeid);
        }
     
        $(function () {
            // Bind the event.
            $(window).hashchange(function () {
                if (!byScript) {
                    if (location.hash.indexOf("#node=") > -1) {
                        ClickNode(location.hash.split("=")[1]);
                    }
                }
                byScript = false;
            })
        });
     
        $().ready(function () {
            $("#tabs").tabs({ cookie: { expires: 1} });
     
            setTimeout(function () {
                if ($.cookie("FocusTargetID") != null) {    //FocusTarget is set by a submit form
                    $($.cookie("FocusTargetID")).focus(); //OnSubmit the Form will set the cookie
                    $.cookie("FocusTargetID", null);      //And when the page returns, the focus is set
                }
     
                if ($.cookie('SelectedNode') != null) {
                    ClickNode($.cookie('SelectedNode'));
                } else {
                    byScript = false;
                    $(window).hashchange();
                }
            }, 0);
        });

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > TreeView > findNodeByText and fincNodeByValue are missing in MVC version !!
Related resources for "findNodeByText and fincNodeByValue are missing in MVC version !!"

ASP.NET MVC TreeView Features  |  Documentation  |  Demos  |  Telerik TV ]