1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    5
    Vote Rating
    0
    neri alamanni is on a distinguished road

      0  

    Default Unanswered: Populating grid panel dynamically

    Unanswered: Populating grid panel dynamically


    Hi all
    I am trying to populate dynamically a grid panel. I.e no model with static definition of fields is used. The grid columns are created on the fly and the grid should be filled extracting from JSON response from the server those parameters matching the column names. But nothing but the column names appers on the grid.
    The code fragment supposed to populate the grid is:
    // reset manager store
    mgr_grid=Ext.ComponentQuery.query('managergrid')[0];
    store=mgr_grid.getStore();
    store.loadData([],false);

    var cols=[];


    var item2 = {};
    item2.xtype = 'gridcolumn';
    item2.text = "_id";
    item2.dataIndex = '_id';
    cols.push (item2);
    var item2 = {};
    item2.xtype = 'gridcolumn';
    item2.text = "_name";
    item2.dataIndex = '_name';
    cols.push (item2);
    store.getProxy().url = record.raw.link; //the url is valid
    mgr_grid.reconfigure(store, cols);

    the content JSON response is like:
    • items: [{_status:{success:true, message:null, code:0},…}, {_status:{success:true, message:null, code:0},…},…]
      • 0: {_status:{success:true, message:null, code:0},…}
        • _created: 1262300401000
        • _createdBy: "admin"
        • _description: ""
        • _id: "CLL-21"
        • _isLocked: false
        • _links: {versions:{title:Versions for Class lifecycle 'Entity', name:Versions,…},…}
        • _lockComment: null
        • _lockUsername: null
        • _modified: 1262300401000
        • _modifiedBy: "admin"
        • _name: "Entity"..

    Where is my error? Am I trying to do something possible?
    Thank you
    best regards
    Neri Alamanni

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,525
    Vote Rating
    871
    Answers
    3564
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Did you look at the store and what data is in it?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1