C1TreeView traversing Client Side

Originally Posted 22 January 2015, 11:37 pm EST

  • Originally Posted 22 January 2015, 11:37 pm EST

    HI

    How can I traverse C1TreeView nodes in client-side script :

    1.get all nodes including checked/value property for each node

    2.traverse node-path from current checked/selected node to topmost(ClientNodeCheckChanged/ClientSelectedNodeChanged) :

    A
    A1
    [v]A1.1

    function C1TreeView1_ClientNodeCheckChanged(e, data)
    {

    e.target.parentNode ...

    *including checked/value property for each parent too.


    Best regards

    chris
  • Reply

    and how can I makes the C1TreeView focus the indicated node (node = findNodeByText -> node.focus).
  • Reply

    After getNodeByText, how can I change property value of node (checked, selected, text, etc).

    *wijmo should provide more brief wijmo api documentation similar to jquery ui (http://api.jqueryui.com/dialog/, options/methods/events and samples). wijmo provides lots of functionalities but nobody knows how to use them(leak of wijmo api doc).
  • Reply

    Hello,

    I am working on creating a sample which fulfills your above requirements. I would need some time to implement the same. I would soon share my observations on the same. In the meanwhile, you may refer to the following documentation links that specify the client side API for C1TreeView:

    http://wijmo.com/docs/wijmo/#Wijmo~jQuery.fn.-~wijtree.html
    http://wijmo.com/docs/wijmo/Wijmo~wijmo.tree.wijtreenode.html.

    Thanks,
    Manpreet Kaur
  • Reply

    Dear

    I have found the description about c1treeviewnode and some problem was solved :

    Node path from checked/selected node to root node :


    function C1TreeView1_ClientNodeCheckChanged(e, data)
    {
    ...
    var result = "";
    var value;
    //
    do
    {
    value = node.options.value;
    if (value == undefined)
    break;
    ...
    // get the parent node of the node
    node = $(node.element).c1treeviewnode("getOwner");
    } while (node != null);
    //
    return result;


    Uncheck indicated node :


    node = $(tree).c1treeview("findNodeByText", text);
    if (node != null)
    $(node.element).c1treeviewnode("check", false);


    I think the help of wijmo doc is very hard to search :
    ex.c1treeviewnode - Wijmo API > Namespaces > wijmo.tree Namespace > Types > wijtreenode
    maybe wijmo can provide more easier on-line guide (similar to jquery-ui) for wijmo developers,
    and wij/c1 name prefix would makes developer confused, maybe there could place some comments at somewhere.

    I still don't know how to focus(scroll to) the indicated node of C1TreeView.

    Best regards

    Chris
  • Reply

    Hello,

    1. You can use the follwoing code to get all the nodes with their text/value/check state:

      function GetAllNodes() {
    var nodes = $("#C1TreeView1").c1treeview("getNodes");
    $(nodes).each(function (index) {
    PrintNodesNodesRecursive($(this));
    });
    }

    function PrintNodesNodesRecursive(oParentNode) {
    alert("Text: " + oParentNode[0].options.text);
    alert("Value: " + oParentNode[0].options.value);
    alert("Checked: " + oParentNode[0].options.checked);

    $(oParentNode[0].getNodes()).each(function (index) {
    PrintNodesNodesRecursive($(this));
    });
    }


    2. You can use the following to focus a specific node in C1TreeView:

    var textToFind = $("#txtFind").val();
    $("#C1TreeView1").c1treeview("findNodeByText", textToFind).select(true);
    var pnode = $("#C1TreeView1").c1treeview("findNodeByText", textToFind).getOwner();
    if (pnode != null) {
    pnode.element.c1treeviewnode("expand");
    }



    Kindly refer to the attached sample which implements both the above code snippets. Hope it helps.

    Thanks,
    Manpreet Kaur
    2015/01/ClientTreeScript.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels