1. #1
    Touch Premium Member
    Join Date
    Aug 2009
    Location
    San Diego, CA
    Posts
    31
    Vote Rating
    0
    DroidIn.net is on a distinguished road

      0  

    Default Passing complex tree node to the server

    Passing complex tree node to the server


    I have a tree in my application that defines the following model

    Code:
    Ext.define('QuiApp.model.ReportTreeNode', {
        extend: 'Ext.data.Model',
    
    
        idProperty: 'execId',
    
    
        fields: [
            {
                name: 'execId'
            },
            {
                name: 'name'
            },
            {
                name: 'parentId'
            },
            {
                name: 'factoryName'
            },
            {
                name: 'execCount'
            }
        ]
    });
    However when I attempt to drill into the top node I always get this limited GET request: http://localhost:8080/qui/reports/tr...90656114&node=
    The node parameter is always empty so I'm guessing that my store/proxy and reader are not configured correctly. Here's store code:

    Code:
    Ext.define('QuiApp.store.base.ReportTreeStore', {
        extend: 'Ext.data.TreeStore',
        requires: [
            'QuiApp.model.ReportTreeNode'
        ],
    
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: true,
                storeId: 'ReportTreeStore',
                model: 'QuiApp.model.ReportTreeNode',
                nodeParam: 'node',
                proxy: {
                    type: 'ajax',
                    url: 'http://localhost:8080/qui/reports/tree/viewTree.action',
                    reader: {
                        type: 'json',
                        idProperty: 'id',
                        messageProperty: 'name'
                    }
                }
            }, cfg)]);
        }
    });
    How do I reconfigure this to provide complete node information in request?

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    The node property that is sent will be the id.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Touch Premium Member
    Join Date
    Aug 2009
    Location
    San Diego, CA
    Posts
    31
    Vote Rating
    0
    DroidIn.net is on a distinguished road

      0  

    Default


    I tried changing nodeParam (if that is what you are referring to to "id" but that has no effect. I don't see anything being sent. Also is there a way to sent whole JSON for the tree node I selected?

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    No, there is no way to send the entire data of that node.

    If you specify an id for that node, it will send the id to the server in a post.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Touch Premium Member
    Join Date
    Aug 2009
    Location
    San Diego, CA
    Posts
    31
    Vote Rating
    0
    DroidIn.net is on a distinguished road

      0  

    Default


    You mean no way with type of proxy Designer 2 supports? Why can I use
    Ext.data.HttpProxy and send that JSON as body doing a POST? Anyways like I said, even when I do nodeParam: 'id' or 'execId' I always see empty node in the GET request

  6. #6
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Of course it could be implemented but its not supported out of the box.

    You would have to override the tree behavior. I can't tell by first glance at whats wrong with why its not sending the id. You will probably have to step through the load process.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  7. #7
    Touch Premium Member
    Join Date
    Aug 2009
    Location
    San Diego, CA
    Posts
    31
    Vote Rating
    0
    DroidIn.net is on a distinguished road

      0  

    Default


    Just to be clear. Right now if I modify any JS files by hand there's no way of importing changes back to Designer 2? Are you referring to Ext.load?

  8. #8
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    You can modify external files like overrides without problem.

    I am referring to the load process of treenodes as they are expanded.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  9. #9
    Touch Premium Member
    Join Date
    Aug 2009
    Location
    San Diego, CA
    Posts
    31
    Vote Rating
    0
    DroidIn.net is on a distinguished road

      0  

    Default


    Is there any example on how to create overrides? I'm very new to Ext JS and struggling with basic concepts. I like to use Designer to layout my components but what are the best practices for writing code for the actual project? I'm using Eclipse with JS tools (beside the Designer) and Spring MVC on the back end. I would like to have Designer files always generated by tool but how to incorporate that with files I'll be coding by hand? Sorry for offtopic

  10. #10
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 1

Tags for this Thread