English 中文(简体)
ExtJS: paging not work andurs button
原标题:ExtJS : paging not working and refresh button
  • 时间:2012-05-10 12:21:00
  •  标签:
  • extjs
  • extjs4

我使用以下代码。 我看见电网,内容正确,但页数部分奇怪。

  1. The button "next", "previous", ... are not enabled. There are 4 records and I ask 3 records by page, I should see "Page 1 of 2"
  2. How can I manage the "refresh" button.

“entergraph

感谢

    $(document).ready(function () {

        Ext.define( User , {
            extend:  Ext.data.Model ,
            fields: [
            { name:  FirstName , type:  string  },
            { name:  LastName , type:  string  },
            { name:  Email , type:  string  }
        ]
        })

        var userStore = Ext.create( Ext.data.Store , {
            model:  User ,
            proxy: {
                type:  ajax ,
                url:  /Home/GetUsers ,
                reader: {
                    type:  json ,
                    root:  users 
                }
            },
            autoLoad: true
        });


        Ext.create( Ext.grid.Panel , {
            renderTo:  testing ,
            store: userStore,
            autoScroll: true,
            layout:  fit ,
            title:  Users ,
            width:450,
            columns: [{
                text:  First Name ,
                width: 225,
                sortable: true,
                dataIndex:  FirstName ,
                editor: {
                    xtype:  textfield ,
                    allowBlank: false
                }
            },
            {
                text:  Last Name ,
                width: 225,
                sortable: true,
                dataIndex:  LastName ,
                editor: {
                    xtype:  textfield ,
                    allowBlank: false
                }
            }],
            bbar : Ext.create( Ext.toolbar.Paging , {
                store: userStore,
                pageSize: 3,
                displayInfo: true,
                displayMsg:  Displaying topics {0} - {1} of {2} ,
                emptyMsg: "No topics to display"
            })

        });

    });

Update1 :

{"total":2,"success":true,"data":[{"Id":1,"FirstName":"AA","LastName":"BB"},{"Id":2,"FirstName":"CC","LastName":"DD"},{},{}]}

我看不到“2岁×”

问题回答

http://jsfiddle.net/AnYeq/1/ I don t see anything wrong with the current page text. Even with test json data without “total” property. Controlling the refresh button is not so obvious. You can try to extend Ext.toolbar.Paging and override its private method getPagingItems.





相关问题
ExtJS load form items/fields from database

I am using ExtJS 3 here. I would like to populate a formpanel from database with fields to be submitted. Basically, I don t know witch fields my form will have and I want to generate all formpanel ...

How to use Ext JS for role based application

I am planning to use Ext JS for a large application. The application s features are role based. When user login, they only see menu and screen features related to them. My server side technology will ...

Dynamically adding a TabPanel to a Panel Region

I have a Panel layout with a TreePanel in one region. A user clicks on an node in the tree and a TabPanel should be displayed in another region with information, editing tools etc. for that tree node....

How to embed Json result within Extjs Panel?

I have some issues with Json result and embed it within the html of the Extjs Panel. Here s that I have managed to get so far. myPanel is embedded within a mainPanel, and I have some shows/hide of ...

Ajax data update. Extjs

I need to keep certain data ( in a grid) up to date and was gonna do a poll to the server every 15 seocnds or so to get the data and refresh the grid, however it feels a bit dirty ( the grid will have ...

Better way to call superclass method in ExtJS

All the ExtJS documentation and examples I have read suggest calling superclass methods like this: MyApp.MyPanel = Ext.extend(Ext.Panel, { initComponent: function() { // do something MyPanel ...

Merged Headers in Ext JS Grid

Is it possible to have two headers in Ext JS grids? I have to show my grid as grouped data.. for example product types and products. In my case I need a grid like this: Field | Product Type A ...

热门标签