-
21 May 2012 7:58 AM #1
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....
...and here is a sample JSON service message....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); } });
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
-
23 May 2012 5:36 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3156
Are you trying to use hasMany to display the child nodes?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
23 May 2012 5:42 AM #3
I suppose so...
I suppose so...
...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.
-
23 May 2012 5:47 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3156
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
23 May 2012 5:57 AM #5
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


Reply With Quote