Results 1 to 10 of 10

Thread: Problem to show the data of a XML in a grid

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default Problem to show the data of a XML in a grid

    This is the code create by the Architect 2.1.0
    Panel:
    Code:
    Ext.define('MyApp.view.MyPanel', {
        extend: 'Ext.panel.Panel',
    
        frame: true,
        height: 443,
        width: 614,
        layout: {
            align: 'stretch',
            type: 'vbox'
        },
        title: 'My Panel',
    
        initComponent: function() {
            var me = this;
    
            Ext.applyIf(me, {
                items: [
                    {
                        xtype: 'gridpanel',
                        autoShow: false,
                        height: 245,
                        stateId: 'Grid',
                        title: 'My Grid Panel',
                        store: 'MyXmlStore',
                        viewConfig: {
                            frame: true
                        },
                        columns: [
                            {
                                xtype: 'gridcolumn',
                                dataIndex: 'Marca',
                                text: 'Marca'
                            },
                            {
                                xtype: 'gridcolumn',
                                dataIndex: 'Modello',
                                text: 'Modello'
                            },
                            {
                                xtype: 'gridcolumn',
                                dataIndex: 'Targa',
                                text: 'Targa'
                            },
                            {
                                xtype: 'booleancolumn',
                                dataIndex: 'Disponibile',
                                text: 'Disponibile'
                            },
                            {
                                xtype: 'numbercolumn',
                                dataIndex: 'Limite_Km',
                                text: 'Limite_Km'
                            },
                            {
                                xtype: 'numbercolumn',
                                dataIndex: 'Priorita',
                                text: 'Priorita'
                            }
                        ]
                    },
                    {
                        xtype: 'panel',
                        flex: 1,
                        title: 'My Panel'
                    }
                ]
            });
    
            me.callParent(arguments);
        }
    
    });
    Store:
    Code:
    Ext.define('MyApp.store.MyXmlStore', {
        extend: 'Ext.data.Store',
    
        requires: [
            'MyApp.model.MyModel'
        ],
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: true,
                filterOnLoad: false,
                storeId: 'MyXmlStore',
                model: 'MyApp.model.MyModel',
                clearOnPageLoad: false,
                clearRemovedOnLoad: false,
                proxy: {
                    type: 'ajax',
                    url: 'http://localhost/Auto.xml',
                    reader: {
                        type: 'xml',
                        root: 'dataroot',
                        record: 'Auto'
                    }
                }
            }, cfg)]);
        }
    });
    Models:
    Code:
    Ext.define('MyApp.model.MyModel', {
        extend: 'Ext.data.Model',
    
        fields: [
            {
                name: 'Marca',
                type: 'string'
            },
            {
                name: 'Modello',
                type: 'string'
            },
            {
                name: 'Targa',
                type: 'string'
            },
            {
                name: 'Disponibile',
                type: 'boolean'
            },
            {
                name: 'Limite_Km',
                type: 'int'
            },
            {
                name: 'Priorita',
                type: 'int'
            }
        ]
    });
    File XML:
    Code:
    <?xml version="1.0" encoding="UTF-8"?> 
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="Auto.xsd" generated="2012-12-07T22:44:11"> 
    <Auto> 
    <Marca>BMW</Marca> 
    <Modello>135</Modello> 
    <Targa>bf444rt</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>200</Limite_Km> 
    <Priorita>3</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>BMW</Marca> 
    <Modello>Serie 4</Modello> 
    <Targa>fd435tr</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>180</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Fiat</Marca> 
    <Modello>Stilo</Modello> 
    <Targa>gr567yt</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>450</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Fiat</Marca> 
    <Modello>Stilo</Modello> 
    <Targa>hg876jy</Targa> 
    <Disponibile>0</Disponibile> 
    <Limite_Km>450</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Fiat</Marca> 
    <Modello>Stilo</Modello> 
    <Targa>ku876rt</Targa> 
    <Disponibile>0</Disponibile> 
    <Limite_Km>400</Limite_Km> 
    <Priorita>1</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Fiat</Marca> 
    <Modello>Panda</Modello> 
    <Targa>gf457jy</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>350</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Fiat</Marca> 
    <Modello>Panda</Modello> 
    <Targa>ng876jy</Targa> 
    <Disponibile>0</Disponibile> 
    <Limite_Km>320</Limite_Km> 
    <Priorita>1</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Ford</Marca> 
    <Modello>Focus</Modello> 
    <Targa>vb453rt</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>320</Limite_Km> 
    <Priorita>3</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Ford</Marca> 
    <Modello>Focus</Modello> 
    <Targa>ht567yu</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>280</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Ford</Marca> 
    <Modello>Focus</Modello> 
    <Targa>nb778hg</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>280</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Ford</Marca> 
    <Modello>Fiesta</Modello> 
    <Targa>fr453rt</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>350</Limite_Km> 
    <Priorita>1</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Ford</Marca> 
    <Modello>Fiesta</Modello> 
    <Targa>bt675ht</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>400</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Ford</Marca> 
    <Modello>Ka</Modello> 
    <Targa>vc453gt</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>240</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Volkswagen</Marca> 
    <Modello>Golf</Modello> 
    <Targa>nb654tr</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>450</Limite_Km> 
    <Priorita>2</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Volkswagen</Marca> 
    <Modello>Passat</Modello> 
    <Targa>gf343tr</Targa> 
    <Disponibile>1</Disponibile> 
    <Limite_Km>700</Limite_Km> 
    <Priorita>3</Priorita> 
    </Auto> 
    <Auto> 
    <Marca>Volkswagen</Marca> 
    <Modello>Polo</Modello> 
    <Targa>nh676ht</Targa> 
    <Disponibile>0</Disponibile> 
    <Limite_Km>300</Limite_Km> 
    <Priorita>1</Priorita> 
    </Auto> 
    </dataroot>
    The XML is at the url: localhost/Auto.xml
    Someone can say me where are the errors?
    I'm trying to learn this language but is so difficult as the beginning...
    sorry for my english

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    146
      0  

    Default

    There were 4 duplicates of the same post. I've consolidated it into this one thread and approved it (it was in moderation).

    What happens? Are there any errors? Are you hosting it on localhost? Does the grid show up without the data?
    Aaron Conran
    @aconran

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default

    In the architect i can see all the data but when i launch the page it show only the grid without data... sorry for the duplicates but when i reload the page it didn't show the new thread and i thought it has not been send

  4. #4
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    146
      0  

    Default

    Is your Store added to the stores configuration on Application?
    Aaron Conran
    @aconran

  5. #5
    Sencha User
    Join Date
    Dec 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default

    If you mean in Ext.app.Controller the MyXmlStore is already add

  6. #6
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    146
      0  

    Default

    If you execute
    Ext.getCmp('MyXmlStore').getRange()

    on the console do you see records returned?

    Did you see it make a request?
    Aaron Conran
    @aconran

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •