PDA

View Full Version : How to get the first and last records of a data store?



smick
28 Oct 2010, 10:44 AM
Hello,

How would I go about fetching the first and last records of a data store?

This is my data store:



var oStoreResults = new Ext.data.JsonStore({
root: 'rows',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: true,

fields: [
'id',
'something',
'something_else'
],

// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
proxy: new Ext.data.HttpProxy({
url: "./data/search_data.php"
})
});
oStoreResults.setDefaultSort('id', 'desc');
oStoreResults.load({params:{start:0, limit:5}});



Thanks for any help. I'm sure this is an easy one.

Tim Toady
28 Oct 2010, 11:06 AM
store.getAt() and store.getCount()

That should be enough to figure it out.

http://dev.sencha.com/deploy/dev/docs/?class=Ext.data.Store