1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    49
    Vote Rating
    0
    luisoswaldo is on a distinguished road

      0  

    Default Tree with childrem + Data Base Mysql

    Tree with childrem + Data Base Mysql


    I'm using the example of this page http://www.sencha.com/learn/Tutorial...ader_PHP_MySQL to create a dynamic tree with children.

    The problem is I have a number of items and one of them must be a submenu, that is, they must deploy and display other items.

    I do not know how to capture the event when it displays the folder to display and update the parameter subintems receiving php class example above to display the subitems.

    I'm doing in the following way but I can not work.

    Code:
    var tree = new Ext.tree.TreePanel({
            id: 'tree_maestro',
            //title: 'Sample Layouts',
            region:'north',
            split: true,
            //height: 300,
            minSize: 150,
            autoScroll: true,
            border:false,
            
            // tree-specific configs:
            rootVisible: false,
            lines: false,
            singleExpand: true,
            useArrows: true,
            
            loader: new Ext.tree.TreeLoader({
                dataUrl: 'models/menu/list.php',
                baseParams: {node:'0'}  
                
            }),
            
            root: new Ext.tree.AsyncTreeNode({
                //id : 0 
            })
        });    
    
    tree.addListener('load', function(node){        
            console.log(tree.getLoader().baseParams)
            params = tree.getLoader().baseParams;
            params.node='14';
    Appreciate any help I can offer

  2. #2
    Sencha User
    Join Date
    Jun 2010
    Posts
    49
    Vote Rating
    0
    luisoswaldo is on a distinguished road

      0  

    Default


    Any idea?

    I give you a screenshot. As you can see the problem is that I repeated in the main submenu items instead of charging the appropriate items.


    tree.JPG

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Posts
    49
    Vote Rating
    0
    luisoswaldo is on a distinguished road

      0  

    Default


    Any idea?

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,568
    Vote Rating
    307
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    I couldn't really understand your description of the problem but I think I figured it out from your screenshot.

    Make sure you're using something like Firebug to watch the requests sent by the loader to the server. This can be very enlightening.

    By default the loader will send off the node's id to the server, using the parameter configured using the nodeParameter config setting. Under most circumstances this should prove sufficient and there is no need to use any trickery using listeners or baseParams.

    However, if you want to send other properties of the node you can use the beforeload event (not load as you're using in your code) to manipulate the loader's baseParams immediately prior to the request being made. Though you could do this on the treepanel (like your current code) it'd be better just to add a listeners block to your treeloader.

  5. #5
    Sencha User
    Join Date
    Jun 2010
    Posts
    49
    Vote Rating
    0
    luisoswaldo is on a distinguished road

      0  

    Lightbulb


    Thanks for answering, now I understand how it works. What is not is like firebug check through what is the value that sends code.

    Would be helpful if I explain how to view such values, because if I do not see the code and do a console.log not how.

  6. #6
    Sencha User
    Join Date
    Jun 2010
    Posts
    49
    Vote Rating
    0
    luisoswaldo is on a distinguished road

      0  

    Default


    Fixed. The mistake was that I was using an id string. Converted to int the id and it worked perfectly.

    Just like I know how to make the parameter debbug code?

    It is possible to debud PHP code with firebug + FirePHP?

  7. #7
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,568
    Vote Rating
    307
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Just like I know how to make the parameter debbug code?
    I'm afraid I don't understand the question. I'll have a go at explaining some of the basics of debugging though, see if that helps. Firefox's Firebug and the Chrome Developer Tools are both quite similar, this advice applies to both.
    • You can view all the HTTP requests made by your application; seeing the request parameters, headers as well as the response.
    • They feature tools for inspecting and dynamically editing the HTML/DOM and CSS of your page.
    • The JavaScript console will show error messages with stacktraces, allowing you to dig into any errors that are thrown. The JavaScript consoles also allow you to run any arbitrary code at any point. It is where the output of calls to console.log() and console.dir() is shown, providing a simple way to do debug logging though you should remove such logging once you have finished debugging an issue.
    • The Script tabs allow you to view all of the JavaScript source for your application. You can insert breakpoints and conditional breakpoints that will pause application execution and allow you to inspect the stack and variables and step through execution of code from that point onwards.

    In all cases you need to use ext-all-debug.js if you want to do meaningful debugging. I've generally found Chrome easier to work with on such a large JS file, with ctrl+G (go to line) and ctrl+f (find) both being very useful when trying to insert breakpoints in the right place.

    It is possible to debud PHP code with firebug + FirePHP?
    I don't know.

  8. #8
    Sencha User
    Join Date
    Jun 2010
    Posts
    49
    Vote Rating
    0
    luisoswaldo is on a distinguished road

      0  

    Default


    Thank you very much for the explanation. I understand some things they did not understand.

    I just need practice.

    I am grateful for the help.

Thread Participants: 1

Tags for this Thread