-
12 Jun 2012 2:34 AM #1
Answered: xml fields control and view
Answered: xml fields control and view
Hi, i'm working on a project that take an xml file and show the fields in a view.
First problem: I've followed the "getting started" video and I've obtained a working code but in a list form (because in the video the author build a blog post list). How can I obtain the "showing" of data in a normal view (so not in a list)?
Second problem: I want to have control of the xml fields. I want to control if one or more field that I show is empty and if so, I want to hide that field from the view. How can I obtain this? Are there any methods to call and in which way I can do that?
Here is the code:
Thank you for support,Code:Ext.define("app.view.Cliente", { extend: 'Ext.navigation.View', xtype: 'daticliente', config: { title: 'Dati Cliente', iconCls: 'star', items: { xtype: 'list', itemTpl: '<h1>{struttura}</h1>'+ '<span>{email}</span><br />'+ '<span>{url}</span>'+ '<span>{longitudine}</span>', store: { autoLoad: true, fields: ['struttura', 'email', 'url', 'longitudine'], proxy: { type: 'ajax', url: 'http://www.test.com/xml', reader: { type: 'xml', record: 'data' } } } } } });
C.
-
Best Answer Posted by mitchellsimoens
If you don't want to use a list you will need to get the data manually like looping through the store and get each record's data to build an array of objects or just one record. Then I would use a template and setData on the component.
-
13 Jun 2012 5:30 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3106
If you don't want to use a list you will need to get the data manually like looping through the store and get each record's data to build an array of objects or just one record. Then I would use a template and setData on the component.
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.
-
18 Jun 2012 1:22 AM #3


Reply With Quote