2
votes

I know by advance that my question will be a stupid one, but I just started JS few weeks ago and I'm not enough familiar with some concepts.

I'm trying to add a paging toolbar to my grid. I wasn't succeeded well : my toolbar is OK, it display the number of pages I wanted but there is still all my data on every page.

After following some tutorials here and there, I added a store.load to my Store code :

var itemsPerPage = 2;

var store = Ext.define('AM.store.Users', {

    extend: 'Ext.data.Store',
    pageSize: itemsPerPage,
    model: 'AM.model.User',

    proxy: {
        type: 'ajax',

        api: {
            read: 'application/data/users.json',
            update: 'application/data/updateUsers.json',
        },
        reader: {
            type: 'json',
            root: 'users',
        idProperty: 'POC',
            successProperty: 'success',
        totalProperty : 'total'
        }
    },
    autoLoad: {
        start: 0,
        limit: itemsPerPage
    }
});

this.store.load({
    params:{
       start:0,    
       limit: itemsPerPage
    }
});

Of course, the debug log results with this :

Uncaught TypeError:

Object function constructor() { return this.constructor.apply(this, arguments) || null;} has no method 'load'

(note that my data are still loaded even with this error message)

I followed this tutorial and I can't see what is missing (a function ?)

I don't know if this store.load will make my paging work. All my data are stored locally and I access there through the api commande above. I was told to implement a limit into my request but there is none :(.

Thanks.

1

1 Answers

0
votes

Try changing

var store = Ext.define('AM.store.Users', {

to

var store = Ext.create('AM.store.Users', {