x First time here? Check out the FAQ
Join us a the Umbraco event of the year - get your Codegarden 14 early bird ticket today
  • Avatar4posts24karma

    How to pick node of Multi-Node-Tree-Picker using javascript only ?

    frank harris started this topic August 13, 2012 @ 02:48

    Hello,

    I'm working on umbraco v 4.7.1.1 backoffice, and i'm tring to develop a script using only javascript.

    Currently, I have a "Multi-Node-Tree-Picker" tree with a lot of nodes, each with unique id.
    I wish to understand how can I use javascript, to emulate the picking process of a node.
    (that "process" is the regular left click with the mouse on a node )

    In addition please note:

     

    • I can't change anything within the umbraco system and files.( i'm not the admin and don't have premissions to change anything )
    • Thus, I wish to run this command/script using chrome's built-in java console and/or greasymonkey addon.

     

    On old version of Umbraco, I could use the following command to do that:
    parent.right.nameOfaObjectOrClassDunno.TreeNodeClick(1111);
    (the "1111" is the id of some node)
    In the current version - this method of "picking" a node, does not exist anymore !
    The code of every node under the tree looks like this:

    <li id="1111" class="uc-treenode-click loaded leaf" rel="dataNode" umb:type="FilteredContentTree"><a href="javascript:openContent('1111');" style="background-image:url(&quot;/umbraco/images/umbraco/settingTemplate.gif&quot;);" class=" sprTree noSpr" umb:nodedata="{'menu':'','nodeType':'FilteredContentTree','source':'/umbraco/tree.aspx?rnd=e11111cfe9bd4edb911a222a333333ae&amp;id=1111&amp;treeType=FilteredContentTree&amp;contextMenu=false&amp;isDialog=true&amp;dialogMode=id&amp;nodeKey=1000'}"><div>the content of this node which graphicly I see</div></a></li>

     

    How can I "pick" that node and add it to the picked list, using only javascript commands ? Please advise, thanks, Frank.


  • Avatar3702posts7704karma
    adminComment with ID: 124207
    Jeroen Breuer posted this reply August 14, 2012 @ 08:53

    If you just use .click() on the node that you want to select it should work, but it will only show the node on the right part of MNTP at the selected nodes. If you don't have any permissions to change anything you can't save it.

    Jeroen


  • frank harris posted this reply August 14, 2012 @ 10:55

    Jeroen - Thnx for the reply.

    As you can understand - I don't understand Umbraco at all - I'm an amateur java programmer.

    The lack of "admin" privileges means that I don't have any control on umbraco as developer...
    I only have access as a backoffice user, that only enter content to the site I work on.
    I have enough privileges to pick with the mouse a node from the MNTP tree and add it to "the right side", and enough privileges to save that pick.
    I want to make my work on umbraco more efficient, thus the need to understand how to approach MNTP through javascript.

    In the previous version of umbraco I could run a javascript command to pick a really deep level node from the MNTP, using only 1 command. ( as I wrote already).
    My problem with your suggestion is that I literally need to open the branches of the tree inorder to run the ".click()" command on a node.
    ( becuase if the tree is not cascaded - the node's code does not exist in the html code )

    I wish to "pick" an internal node from specific MNTP ( there are few ), and to move it to the "picked node area on the right" - without the need to open X branches before I see the node.
    Maybe there a way for me to declare a new object, which then "gets" the specific MNTP that I wish to control ? ( but how? what class is that? )
    It could really help me if you could write a javascripted example.

    Thanks again !


Please login or Sign up To post replies