1. #1
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    27
    Answers
    1
    Vote Rating
    0
    montymccune is on a distinguished road

      0  

    Default Unanswered: NestedList and TreeStore issue...

    Unanswered: NestedList and TreeStore issue...


    I am having problems getting my data to display in my nestedlist via this simple itemTpl:
    <div>{SIG}</div>

    Debugging in Chrome shows me that my data IS being returned from my service, my NestedList is displaying the correct amount of rows (based upon the amount of data elements returned) BUT they are all blank so I assume that means my itemTpl isn't exactly right??

    Here are how my models are setup...

    Code:
    Ext.define('PhoenixTouch.model.RxPrefPopover', {
        extend: 'Ext.data.Model',
    
    
        xtype: 'rxPrefPopoverModel',
    
    
        config: {
    
    
            fields: ['Key', 'Value'],
            hasMany:{model:'PhoenixTouch.model.RxPref'}
                
        }
    });
    
    
    
    
    Ext.define('PhoenixTouch.model.RxPref', {
        extend: 'Ext.data.Model',
    
    
        xtype: 'rxPrefModel',
    
    
        config: {
    
    
            fields: [
                {name:'RxPrefID', type:'INT'},
                {name:'Qty', type:'INT'},
                {name:'Refills', type:'INT'},
                {name:'ProviderID', type:'INT'},
                {name:'Drug Name', type:'STRING'},
                {name:'SIG', type:'STRING', mapping: 'rxprefs.SIG'},
                {name:'Type', type:'STRING'},
                {name:'RX_Dosage', type:'STRING'},
                {name:'RX_Form', type:'STRING'},
                {name:'RX_Name', type:'STRING'},
                {name:'RX_Timing', type:'STRING'},
                {name:'RX_Duration', type:'STRING'},
                {name:'RX_Notes', type:'STRING'},
                {name:'IsCompound', type:'BOOL'},
                {name:'RX_Route', type:'STRING'},
                {name:'DispenseAs', type:'INT'},
                {name:'RX_Strength', type:'STRING'}
            ],
            belongsTo: 'PhoenixTouch.model.RxPrefPopover'
        }
    });

    Here is my TreeStore....

    Code:
    Ext.define('PhoenixTouch.store.RxPrefPopover',{
        extend: 'Ext.data.TreeStore',
        
        requires:['PhoenixTouch.model.RxPrefPopover',
                    'Ext.DateExtras'],
    
    
        xtype: 'examPrefPopoverStore',
    
    
        config:{
            model: 'PhoenixTouch.model.RxPrefPopover',
            defaultRootProperty: 'Value',
        },
    
    
        getRxProviderPrefs: function(providerID){
            var tURL = phxUtility.getServerAddress() + '/server/rxproviderlist.svc/rx/list/providerid/' + providerID;
            setupProxy(this, tURL);
        }
    
    
    });
    ...and here is a sample JSON service message....

    Code:
    {
        "Value":[
            {
                "Key":"Analgesics",
                "Value":[
                    {
                    "DispenseAs":0,
                    "Drug_Name":"93516101","SIG":"HYDROCODONE BT IBUPROFEN  2 TAB PO PRN","Type":"Analgesics"...
                    }
                    ]},
            {
                "Key":"Anticoagulants",
                "Value":[
                    {
                    "DispenseAs":0...
                    }
                    ]}, etc...


    Any thoughts as to why my simple itmTpl cannot access the returned data???


    thanks,Monty

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Answers
    3517
    Vote Rating
    856
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Are you trying to use hasMany to display the child nodes?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    27
    Answers
    1
    Vote Rating
    0
    montymccune is on a distinguished road

      0  

    Default I suppose so...

    I suppose so...


    Quote Originally Posted by mitchellsimoens View Post
    Are you trying to use hasMany to display the child nodes?
    ...at this point I'm just trying to get this to work.

    the intended result tree I'm going for would be like this:

    Analgesics
    Drug description 1
    Drug description 2
    Drug description 3
    etc....
    Anticoagulants
    Drug description 4
    Drug description 5
    Drug description 6
    etc...


    in the Chrome console, all the data is there, I just cant for the life of me figure out how to display it.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,207
    Answers
    3517
    Vote Rating
    856
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Start from the basics. Get a JSON structure that each level is the same, use one model and the treestore will take care of the rest.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    27
    Answers
    1
    Vote Rating
    0
    montymccune is on a distinguished road

      0  

    Default


    Screen shot 2012-05-23 at 8.52.18 AM.jpg

    sorry but this is the best way I could explain where I'm at. You can see my JSON message results here via Chrome screenshot. My service returns an array (just showing you the first 2 nodes of 6) - each object contains a 'Key' which is a type of drug and a 'Value' which is another array containing a drug object that falling in the Key category. Plain and simple - I need the Keys to be the first level of the nested list, and the Value.SIG to be the second level - just two levels of tree. Thoughts??? Thanks for the replies, Monty

Thread Participants: 1

Tags for this Thread