1. #1
    Sencha User
    Join Date
    Oct 2012
    Location
    Dublin, California
    Posts
    12
    Vote Rating
    0
    drgaryholland is on a distinguished road

      0  

    Default How do you add a row of data to a store

    How do you add a row of data to a store


    I have a restful app that I am trying to add a button to a toolbar on a tab panel where the grid resides. The grid populates with data so now I want to add a button who's action would be add a blank row in the grid. I have tried cancelEdit() , store.insert(0, model) to no avail. I need someone to point me in the right direction. My store looks like this:

    //Thanks in advance

    Ext.define('ShopTrack.store.UserMasterStore', {
    extend: 'Ext.data.Store',
    alias: 'store.userMasterStore',


    requires: [
    'ShopTrack.model.User'
    ],


    constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
    autoLoad: true,
    autoSync: true,
    filterOnLoad: false,
    sortOnLoad: false,
    storeId: 'userMasterStore',
    model: 'ShopTrack.model.User',
    proxy: {
    type: 'rest',
    url: 'http://localhost/services/webresources/shoptrack.usermaster/',
    reader: {
    type: 'xml',
    root: 'userMasters',
    record: 'userMaster'
    }
    }
    }, cfg)]);
    }
    });

  2. #2
    Sencha User
    Join Date
    Oct 2012
    Location
    Dublin, California
    Posts
    12
    Vote Rating
    0
    drgaryholland is on a distinguished road

      0  

    Default


    I found the answer to my own question. Being the code editing features of Architect are limited and the fact I am new to Ext, I found that by assigning the instance of the store to a variable using getStore(StoreName) then using that vartiable to do a store.add(ModelRecord).

  3. #3
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,191
    Vote Rating
    63
    aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice

      0  

    Default


    You are correct

    Code:
    store.add({ /* config */ });
    Aaron Conran
    @aconran
    Sencha Architect Development Team