mercredi 8 février 2017

ExtJS Grid - how do I reference a store by id in my view

Vote count: 0

I am trying to reference a store in my app for the purpose of adding a paging tool bar at the bottom of my gird. In most examples I have studied the store is referenced by variable, ex: store: someStore. However, by I have build my app a little differently and did create a reference variable to the store. I have tried assigning an id but this did not work.

Here is what I have:

In my view Grid.js:

Ext.define('myApp.view.user.Grid', {
    extend: 'Ext.grid.Panel',
    viewModel: {
        type: 'user-grid'
    },
    bind: {
        store: '{users}',
    },
    columns: {...},

    //my paging tool bar
    dockedItems: [{ 
    xtype: 'pagingtoolbar',
    dock: 'bottom',
    store: 'girdStore'
    //store: {users} -> did not work
    }],
    ...

});

In my view model GridModel.js:

Ext.define('myApp.view.user.GridModel', {
    extend: 'Ext.app.ViewModel',

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

    stores: {
        users: {
            model: 'myApp.model.User',
            storeId: 'gridStore',
            autoLoad: true,
        }
     },
     formulas: {...}

  });

When I try to reference the {users} store by id 'gridStore' I get this error:

Uncaught TypeError: Cannot read property 'on' of undefined

What is the best way to proceed without completely refactoring my model?

asked 15 secs ago

Let's block ads! (Why?)



ExtJS Grid - how do I reference a store by id in my view

Aucun commentaire:

Enregistrer un commentaire