1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    103
    Vote Rating
    0
    Answers
    4
    izak18 is on a distinguished road

      0  

    Default Answered: Set data into my store

    Answered: Set data into my store


    Hi guys, I have a problem when I try to set data into my store, I saw in this post one way to do that but is using ST 2.0, how can I do the same but in 1.1? I refer to:

    http://www.sencha.com/forum/showthread.php?196949-SOLVED-Load-store-from-a-variable.

    This is my code:

    Code:
    ui: 'confirm',		    text: 'Buscar',
    		    iconMask: true,
    		    iconCls: 'search',
    		    handler: function() {
    		        formBuscaMat.submit({
    		            params: {
    		                codigo: formBuscaMat.getValues().codigo,
    		                codigoAntiguo: formBuscaMat.getValues().codigoAntiguo,
    		                descripcion: formBuscaMat.getValues().descripcion
    		            },
    		            method: 'POST',
    		            waitMsg: { message: 'Connecting...', cls: 'demos-loading' },
    		            success: function(form, action) {
    		                if (action.success) {
    		                    var lista = new listaMatModel(action.materiales);
    		                    var store = listaMat.getStore();
    		                    console.log(store);
    		                    store.setData(lista);
    		                    store.sync();
    		                    buscaMatView.setActiveItem('listaMatPanel', { type: 'slide', direction: 'left' });
    		                }
    		            }
    		        });
    		    }
    Store:

    Code:
    var listaMatStore = new Ext.data.Store({
        proxy: new Ext.data.LocalStorageProxy(
        {
            id: 'materialData',
            proxy:
            {
                idProperty: 'listaMatStore'
            }
        }),
        model: 'listaMatModel',
        autoLoad: true,
        autoSave: true
    });
    Please help me, any idea.
    Thanks in advance.

  2. instead of setData, you can add the records in

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,666
    Vote Rating
    435
    Answers
    3110
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      -1  

    Default


    instead of setData, you can add the records in
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    103
    Vote Rating
    0
    Answers
    4
    izak18 is on a distinguished road

      0  

    Default


    That's right, I did it with method add() and it works perfectly.
    Thanks!

Tags for this Thread