PDA

View Full Version : a simple problem with paging



ahsec
3 May 2012, 1:53 AM
Hi
I'm trying to use paging...my json contains about 36 elements
the page recognizes 36 elements and the page size for the store is defined as 25, so as the limit parameter sent in "load()"


however it returns the whole 36....
here is the json file


[{
'id' :1,
'message':1,
'date':2,
'sid':3,
'user':4,
'ip':5,
'rule group':5,
'description':6,
'score':7,
'status':1
},
{
'id' :1,
'message':1,
'date':2,
'sid':3,
'user':4,
'ip':5,
'rule group':5,
'description':6,
'score':7,
'status':1
}
.
.
.
.
.
.
]
anything I forgot to configure??

thank you

scottmartin
3 May 2012, 7:38 AM
Do you set the page size of the PagingToolbar?
Is you reader have totalProperty set?
Does your JSON return this total value? I do not see it ...



reader: {
type: 'json',
totalProperty: 'total',
successProperty: 'success',
messageProperty: 'message',
root: 'data'
},

{total:"36","data":[ ...


Regards,
Scott.

ahsec
3 May 2012, 9:12 AM
Hey Scott...

Thanks for replying...
I did just what you said..
my json file is now

{
"total":36,
"data":
[
{
'id' :1,
'message':1,
'date':"1321966182",
'sid': "5881ffa6d8f22600e64494dfe6cda7b3a50b4fb65b5764",
'user':"",
'ip':"62.219.xxx.xxx",
'rule_group':"Simbar Victim",
'description':"",
'score':90.0,
'status':1
},
.
.
.
}
]
}

and I've set the json reader to have 'total' as the total property..this is the store..it doesnt have the page size field on its code but I did set it on the designer to 25
proxy: {
type: 'ajax',
url: '/newGui/results.json',
reader: {
type: 'json',
root: 'data'
}
}
I did not see however any page size property for the paging toolbar..they only have the same store(that and the grid panel)

anything else I haven't done that you have noticed???

Thanks!!!!!

scottmartin
3 May 2012, 9:28 AM
The store will need pageSize set. Please verify your setting in designer. You can just add it yourself.

Scott.

ahsec
3 May 2012, 9:41 AM
proxy: {
type: 'ajax',
url: '/newGui/results.json',
reader: {
type: 'json',
root: 'data',
pageSize:25,
}
},

however it still doesnt work..your man pages say it defaults to 25 ...
this it what it looks like...on both pages 1 and 2
34843

ahsec
3 May 2012, 9:45 AM
i also tried adding the pageSize to the store
Ext.define('MyApp.store.a_AlertsStore', {
extend: 'Ext.data.Store',


constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'a_AlertsStore',
proxy: {
type: 'ajax',
url: '/newGui/results.json',
reader: {
type: 'json',
root: 'data',
pageSize:25,
},

},
pageSize:25,
.....

didn't work... :-(

scottmartin
3 May 2012, 10:07 AM
You have it in your proxy.reader .. needs to be in store itself.

Scott.

ahsec
5 May 2012, 11:57 PM
tried the pageSize in both of them together...didn't work... :-(