PDA

View Full Version : paging toolbar not reading the store



gezb
26 Feb 2014, 2:19 PM
Hi, I have created a grid with a FiltersFeature. Everything is working perfect except for the Paging toolbar. It does not have any pages, total records etc. I think it is because it cant see the store. I am not getting any errors. Im using the MVC model. Any pointers would be appreciated. Code below


Ext.define('Contact.view.errors.ErrorList', {
extend: 'Ext.grid.Panel',
alias: 'widget.menuOptsErrors',

store: 'errors.ErrorList',

requires: [
'Contact.view.toolbars.contactPaging'
],
features: [
Ext.create('Ext.ux.grid.FiltersFeature', {
encode: true,
updateBuffer: 1000,
local: false,
})
],

columns [ { blah, blah blah } ],

bbar: [
{
xtype: 'contactPaging',
store: Ext.data.StoreManager.lookup('errors.ErrorList')
}
]
});


Ext.define('Contact.view.toolbars.contactPaging', {
extend: 'Ext.toolbar.Paging',
alias: 'widget.contactPaging',

displayInfo: true

});



Ext.define('Contact.store.errors.ErrorList', {
extend: 'Ext.data.Store',
model: 'Contact.model.errors.ErrorList',

storeId: 'ErrorList',

requires: [
'Contact.util.proxy.contactProxy'
],

sorters: [
{
property: 'error_id',
direction: 'desc'
}
],

pageSize: 20,

proxy: {
type: 'contactProxy',
directionParam: 'dir',
filterParam: 'filter',
groupDirectionParam: 'groupDir',
groupParam: 'group',
limitParam: 'limit',
pageParam: 'page',
sortParam: 'sort',
startParam: 'start',
url: 'php/errors/readErrors.php'
}
});



Ext.define('Contact.util.proxy.contactProxy', {
extend: 'Ext.data.proxy.Ajax',
alias: 'proxy.contactProxy',

directionParam: null,
filterParam: null,
groupDirectionParam: null,
groupParam: null,
limitParam: null,
pageParam: null,
sortParam: null,
startParam: null,

constructor: function() {
this.actionMethods = {
create: 'POST',
read: 'POST',
update: 'POST',
destroy: 'POST'
};
this.reader = {
type: 'json',
messageProperty: 'msg',
root: 'data',
successProperty: 'success',
totalProperty: 'total'
},
this.writer = {
type: 'json',
writeAllFields: true,
encode: true,
allowSingle: false,
root: 'data',
successProperty: 'success'
};
this.callParent(arguments);
}
});

mitchellsimoens
3 Mar 2014, 8:32 AM
First thing I see is you are creating the filter feature but you need to just use a config object:


Ext.define('Contact.view.errors.ErrorList', {
extend : 'Ext.grid.Panel',
alias : 'widget.menuOptsErrors',

store : 'errors.ErrorList',

requires : [
'Contact.view.toolbars.contactPaging'
],
features : [
{
ftype : 'filters',
encode : true,
updateBuffer : 1000,
local : false
}
],

columns [
{ blah, blah blah }
],

bbar : [
{
xtype : 'contactPaging',
store : 'errors.ErrorList'
}
]
});

Next, you have storeId as 'ErrorList' on your store but are using 'errors.ErrorList' in the grid and toolbar?