1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    7
    Vote Rating
    0
    tijuabraham is on a distinguished road

      0  

    Exclamation dynamically loading Xml to store

    dynamically loading Xml to store


    hi
    i want to load dynamically data, field from the Xml and generate a store, so that i can build the grid . the following is my code


    success: function(response) {
    response.responseXML
    var aaron = new Person();
    this.fields=aaron.field(response.responseXML);
    this.column=aaron.col(response.responseXML);
    //this.data=aaron.mydata(response.responseXML);
    //this.mytotal=aaron.mytotal(response.responseXML);
    }
    });
    Ext.define('fieldname', {
    extend: 'Ext.data.Model',
    fields:this.fields
    });
    debugger;
    this.store = Ext.create('Ext.data.Store', {
    model: 'fieldname',
    autoLoad: true,
    proxy: {
    type: 'ajax',
    url: 'test.xml',
    reader: {
    type: 'xml',
    record: 'I'
    }
    }
    });
    i check in the debugger . i am getting field in the following format name:'S' ; mapping : '@S',
    in my XML i have the field named 'S'

    now the problem is i am getting blank field , no data is rendering in to the grid
    if i hard code the field name in the following format , the data is loading into grid
    this.fields=[ {name: 'S', mapping: '@S' }];

    can any body help me to resolve this issue

    regards

    tiju abraham

  2. #2
    Sencha User
    Join Date
    May 2011
    Posts
    7
    Vote Rating
    0
    tijuabraham is on a distinguished road

      0  

    Default


    just bind the fiels name only mapping is not required ..it will automatically map to the data. and while loading the data it should be in the same order as of field