Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    33
    Vote Rating
    0
    snod0g is on a distinguished road

      0  

    Default add/delete/rename tree nodes?

    add/delete/rename tree nodes?


    how can i implement a button that will delete a selected node, add a node to the tree, or do an inline rename of a node?


    also how could i access the changed datamodel so i can send back to server as xml or json or whatever?

  2. #2
    Ext User
    Join Date
    Mar 2007
    Posts
    218
    Vote Rating
    0
    humpdi is on a distinguished road

      0  

    Default


    i would like to know that too..

  3. #3
    Ext Premium Member BernardChhun's Avatar
    Join Date
    Mar 2007
    Location
    Quebec, Canada
    Posts
    831
    Vote Rating
    2
    BernardChhun will become famous soon enough

      0  

    Default


    hey guys,

    to access the selected node of a tree:

    Code:
    var selectedNode = myTree.selModel.selNode;
    adding a new node to the same directory as the selectedNode:

    Code:
    var newNode = new Ext.tree.TreeNode({id: "foo", text: "foo", leaf: true});
    myTree.selModel.selNode.parentNode.appendChild(newNode);
    removing the selectedNode:

    Code:
    var delNode = myTree.selModel.selNode;
    myTree.selModel.selNode.parentNode.removeChild(delNode);
    to implement a button doing these operations, you just need to attach a handler to the onClick event of the button doing what I just wrote. Don't forget to watch for the selectedNode being null or not as a user might click on the button without selecting a node.

  4. #4
    Ext Premium Member BernardChhun's Avatar
    Join Date
    Mar 2007
    Location
    Quebec, Canada
    Posts
    831
    Vote Rating
    2
    BernardChhun will become famous soon enough

      0  

    Default


    edit: arrgg I pressed too fast on the edit button and hitted the quote button instead...

    As for the renaming of the selectedNode, I'd use an inlineEditor but it will be deprecated soon.

    Concerning telling the server side about the changes, I make a XHR call to the server side for each of these operations using the id of the selectedNode and the selected operations. Be sure to have unique IDs if you want to go down that path.

  5. #5
    Ext User
    Join Date
    Jul 2007
    Posts
    5
    Vote Rating
    0
    bharatkarthik is on a distinguished road

      0  

    Default how do i get a node / expand a node etc...

    how do i get a node / expand a node etc...


    I'm defining a function to build a static tree using json.
    I need to write a function to get a node by id, appeend, expand collapse and do some similar kind of operations.

    How do i do that?

    Totally confused with Extjs.. is there any good documentation that gives step up step example?

    function doOperation()
    {
    // How do i get a tree here??



    }

  6. #6

  7. #7
    Ext User
    Join Date
    Apr 2008
    Posts
    1
    Vote Rating
    0
    RedFrog is on a distinguished road

      0  

    Default


    Hi,

    I've read the documentation, but I can not seem to figure out how from a button to access the tree in order to call getNodeById, collapse, expand, etc.

    Nevermind. Sorry to bother. I haven't worked with Javascript in several years and this simple problem just threw me for a loop.

  8. #8
    Ext User
    Join Date
    Apr 2008
    Posts
    25
    Vote Rating
    0
    barboul is on a distinguished road

      0  

    Smile


    When I am trying to delete a node I use this method:
    button in the HTML file:
    Code:
    <button id="button_remove" onClick="Remove_node_and_childs(tree.selModel.selNode)">Remove node and child nodes</button>
    Code in the reoder.js file:

    Code:
         function Remove_node_and_childs(node){
            tree.selModel.selNode.parentNode.removeChild(node);
        }
    unfortunately firebug tell me that tree is not defined, how come?
    tree is the name of my tree...
    I defined it in the
    Code:
    Ext.onReady(function(){
    like that:
    Code:
         var tree = new Tree.TreePanel({
            el:'tree-div',
            useArrows:true,
            autoScroll:true,
            animate:true,
            enableDD:true,
            containerScroll: true, 
            loader: new Tree.TreeLoader({
                preloadChildren:true,
                dataUrl:'get-nodes.php'
            })
        });
    Thanks for your help.
    Ludo

  9. #9
    Sencha User
    Join Date
    Feb 2011
    Posts
    6
    Vote Rating
    0
    akhildmx is on a distinguished road

      0  

    Default


    Were you able to find out the answer to this problem,I came across similar problem of tree not defined.

  10. #10
    Sencha User vcraescu's Avatar
    Join Date
    Apr 2010
    Location
    Romania
    Posts
    6
    Vote Rating
    0
    vcraescu is on a distinguished road

      0  

    Default


    you have to define var tree = null; outside Ext ready function. As you did, tree variable is only visible within Ext ready scope, so it's not global.
    Code:
    <script type="text/javascript">
        var tree = null;
        Ext.onReady(function() {
            tree = new Tree.TreePanel(....
            ...
        });
    </script>
    Havent tried, but that's what i see wrong at first sight.

Similar Threads

  1. using checkboxes with tree nodes
    By eemerge in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 30 Mar 2007, 6:12 PM
  2. insert/update/delete - child nodes - dynamically
    By saravanan in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 4 Mar 2007, 2:58 PM
  3. Copy Tree Nodes Instead of Moving
    By FuryVII in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 28 Feb 2007, 10:13 AM
  4. swapping two tree nodes
    By seldon in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 15 Feb 2007, 6:38 AM
  5. Different Style of Nodes in a same Tree ?
    By nEEbz in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 14 Dec 2006, 12:11 AM

Thread Participants: 9