PDA

View Full Version : Add pager to list in sencha MVC-example



fishbone
16 Aug 2011, 3:45 AM
Hi,

how can I add a pager in a grid-panel if MVC-architecture is used? I copied the files from Ext-4.0/examples/app/simple and successfully ran the example.

Then I added a paging-toolbar as bbar-attribute in 'AM.view.user.List' using two different methods:

1.


Ext.define('AM.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.userlist',

title : 'All Users',
store: 'Users',

columns: [
{header: 'Name', dataIndex: 'name', flex: 1},
{header: 'Email', dataIndex: 'email', flex: 1}
],

bbar: {
xtype: 'paging',
store: 'Users',
displayInfo: false
}
});


results in error "namespace is undefined"

2.


Ext.define('AM.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.userlist',

title : 'All Users',
store: 'Users',

columns: [
{header: 'Name', dataIndex: 'name', flex: 1},
{header: 'Email', dataIndex: 'email', flex: 1}
],

bbar: Ext.create('Ext.toolbar.Paging', {
store: 'Users',
displayInfo: false
})
});


results in error "Store is undefined"

Example is attached.

Thanks in advance,
Uli

skirtle
16 Aug 2011, 3:22 PM
The xtype for a paging toolbar is pagingtoolbar, not paging. Worked for me when I changed it.

fishbone
19 Aug 2011, 4:08 AM
@skirtle
Where do you know this from? The xtype is said to be "paging" in the docs... Should I file a bug ticket?

http://docs.sencha.com/ext-js/4-0/#/api/Ext.Component

skirtle
19 Aug 2011, 9:57 AM
I got it from here:

http://docs.sencha.com/ext-js/4-0/#/api/Ext.toolbar.Paging

Top of the page.

You appear to be correct, there is a mistake. There's a special thread for reporting documentation bugs here:

http://www.sencha.com/forum/showthread.php?135037