1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    0
    cw85 is on a distinguished road

      0  

    Default 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:
    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'
                                    }
                                }
                            }
                        }
                    }
                });
    Thank you for support,
    C.

  2. 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.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    Answers
    3106
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    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.

  4. #3
    Sencha User
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    0
    cw85 is on a distinguished road

      0  

    Default


    Ok thank you for suggestion!

    C.