Results 1 to 2 of 2

Thread: Paging grid - total pading error

  1. #1

    Default Paging grid - total pading error

    Hy guys, help me

    i have a ext grid, and it dont paging...

    the source:


    Code:
    $(document).ready(function() {
    
    var store = new Ext.data.Store({
                proxy: new Ext.data.HttpProxy({
                url: '/Formulario/BuscaMinhaEquipe',
                    dataType: 'json',
                    method: 'GET'
                }),
                reader: new Ext.data.JsonReader({
                    root: 'data',
                    totalProperty: 'totalCount',
                    fields: [
                        { name: 'Editar', mapping: 'Codigo' },
                        { name: 'Codigo', mapping: 'Codigo' },
                        { name: 'Cpf', mapping: 'Cpf' },
                        { name: 'Nome', mapping: 'Nome' },
                        { name: 'Email', mapping: 'Email' },
                    ],
                    sortInfo: {
                        field: 'Codigo',
                        direction: 'ASC'
                    }
                })
            });
    
            var filters = new Ext.ux.grid.GridFilters({
                encode: false, // json encode the filter query
                local: true,   // defaults to false (remote filtering)
                filters: [
                    {
                        type: 'numeric',
                        dataIndex: 'Codigo'
                    }, {
                        type: 'string',
                        dataIndex: 'Nome'
                    }, {
                        type: 'string',
                        dataIndex: 'Cpf'
                    }, {
                        type: 'string',
                        dataIndex: 'Email'
                    }
                ]
            });
    
    
            var createColModel = function(finish, start) {
                var columns = [
                    {
                        id: 'Editar',
                        header: 'Editar',
                        menuDisabled: true,
                        resizable: false,
                        editable: false,
                        fixed: true,
                        sortable: false,
                        dataIndex: 'Editar',
                        header: '',
                        width: 34,
                        heigth:24,
                        filterable: false,
                        renderer: renderIcon
                    },
                    {
                        dataIndex: 'Codigo',
                        header: 'Cdigo',
                        width: 70,
                        sortable: true,
                        filterable: true
                    },
                    {
                        dataIndex: 'Cpf',
                        header: 'CPF',
                        id: 'Cpf',
                        sortable: true,
                        width: 100,
                        renderer: renderMaskCPF
                    },
                    {
                        dataIndex: 'Nome',
                        header: 'Nome do Cliente',
                        id: 'Nome',
                        sortable: true,
                        filterable: true
                    },
                    {
                        dataIndex: 'Email',
                        header: 'E-Mail',
                        id: 'Email',
                        sortable: true,
                        width: 150
                    }
                ];
    
                return new Ext.grid.ColumnModel({
                    columns: columns.slice(start || 0, finish)
                });
            };
            
            var grid = new Ext.grid.GridPanel({
                border: false,
                store: store,
                colModel: createColModel(5),
                autoExpandColumn: 'Nome',
                loadMask: true,
                plugins: [filters],
                listeners: {
                    render: {
                        fn: function() {
                            store.load({
                                params: {
                                    start: 0,
                                    limit: 50
                                }
                            });
                        }
                    }
                },
                bbar: new Ext.PagingToolbar({
                    pageSize: 50,
                    store: store,
                    displayInfo: true,
                    displayMsg: "Pgina {0} - {1} de {2}",
                    emptyMsg: "nenhum cliente foi encontrado",
                    plugins: [filters]
                }),
                autoWidth: true,
                autoHeight: true,
                enableColumnResize: false,
                enableDragDrop: false,
                viewConfig: { forceFit: true },
                renderTo: 'grid-example',
            });
    
            grid.getStore().load();
    });
    my bbar show:


    Page 1 of 7
    Display 1 - 313 of 313




    the sizePage should be 50!!

    how can i fix it?

    thanks


  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    You need to call load, and set parameters for start and limit.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •