Reputation: 254926
Let's say we follow an original article http://www.sencha.com/learn/the-mvc-application-architecture and have such store:
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'data/users.json',
reader: {
type: 'json',
root: 'users',
successProperty: 'success'
}
}
});
And we decided to implement an infinite scrolling grid. To do that we need to remove autoLoad: true
and invoke store.guaranteeRange(...)
manually.
So what is the best place for doing so?
Upvotes: 0
Views: 1259
Reputation: 484
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
remoteSort: true,
buffered: true,
pageSize: 100,
proxy: {
type: 'ajax',
url: '/postdata/list',
limitParam: 'size',
startParam: undefined,
reader: {
type: 'json',
root: 'data',
successProperty: 'success'
}
}
});
Demo here http://ext4all.com/post/extjs-4-1-grid-infinite-scroll-in-mvc
Upvotes: 1
Reputation: 17860
Somewhere where you render your grid. You can overwrite afterRender()
method, or if it's modal grid/dialog - load the store before presenting it.
Couple side note (I'm trying to make a point that autoLoad
usually is false
for all stores:
autoLoad
on all stores. autoLoad
, subscribe to load event and load()
the store manually.Upvotes: 1