1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6
    Vote Rating
    0
    gameboy87 is on a distinguished road

      0  

    Default Unanswered: XMLStore

    Unanswered: XMLStore


    I have the XML of this format

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <users>
      <meta>
        <name>Spencer</name>
      </meta>
        <user>
            <id>1</id>
            <name>Ed Spencer</name>
            <email>ed@sencha.com</email>
        </user>
        <user>
            <id>2</id>
            <name>Abe Elias</name>
            <email>abe@sencha.com</email>
        </user>
    </users>


    How to define the store/model to access <name> tag's value inside the <meta> tag ?

    My store is,

    Code:
    Ext.define('User', {
        extend: 'Ext.data.Model',
        fields: [{name:'id', mapping: 'user > id',type: 'string'},
                 {name:'name',mapping: '@name'}
         ]
    });
    
    
    var store = Ext.create('Ext.data.Store', {
        autoLoad:true,
        model: 'User',
        proxy: {
            type: 'ajax',
            url : 'users.xml',
            reader: {
                type: 'xml',
                record: 'users',
                root: 'users'
            }
        }
    });

    Am I correct in this way ?.

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default Use associations config of model class

    Use associations config of model class


    Hi

    Try this model For nested xml -
    Code:
    Ext.define('app.model.Name', {
        extend: 'Ext.data.Model',
        fields: [{
        name: 'name',
        mapping: 'name',
        type: 'string'}]
    });
    
    Ext.define('app.model.User', {
    extend: 'Ext.data.Model',
        fields: [{
        name: 'id',
        mapping: 'id',
        type: 'int'},
    {
      name: 'name',
      mapping: 'name',
      type: 'string'},
       {
         name: 'email',
         mapping: 'email',
         type: 'string'}],
    
       associations: [{
           type: 'hasMany',
           model: 'app.model.Name',
           name: 'name',
           associationKey: 'User',
           reader: {
             type: 'xml',
            record: 'meta',
            root: 'meta'
       }}
    ],
    proxy: {
        type: 'ajax',
        url: 'data/example.xml',
       reader: {
        type: 'xml',
        record: 'User',
        root: 'Users'
       }
    }
    });
    Read API docs http://docs.sencha.com/ext-js/4-1/#!...g-associations
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6
    Vote Rating
    0
    gameboy87 is on a distinguished road

      0  

    Default


    Will try it out this way and reply soon.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."