Combobox分页工具栏不响应页面大小 [英] Combobox paging toolbar dosn't respond to page size

查看:101
本文介绍了Combobox分页工具栏不响应页面大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从组合框中选择数据库中的项目有一些问题。
由于加载了100多个项目,我使用组合框底部的分页工具栏。
现在,如果页面大小设置为5或50,则页面分页工具栏将显示第1页,共20页或1页2,这取决于pagesize,但是combobox显示所有100个项目,只需将其复制到下一页,如页面大小不是设置在所有。
我在这里和其他论坛看了几篇文章,尝试了几件事情,但似乎没有使它发挥作用。
什么问题?

I'm having some problems with combobox for selecting items from database. Since more than 100 items are loaded, i use paging toolbar at bottom of combobox. Now if pages size is set to 5 or 50, the paging toolbar shows page 1 of 20 or 1 of 2 depending on pagesize, but combobox shows all 100 items, and just copy them to next page like page size is not set at all. I looked at several post here and on other forums and tried several thing but nothing seems to make it work. What's wrong??

 { 

            xtype: 'combobox',          
            queryMode: 'local',
            valueField: 'id',
            fieldLabel: 'Description SKU',
            name: 'id_fk',
            pageSize: 5,                
            width: 400,
            padding: 5,
            store: Ext.create('Ext.data.Store',
                    {
                        fields: ['id','key item','description'],
                        autoLoad: true, 
                        pageSize: 5,                        
                        proxy:
                        {
                            type: 'ajax',
                            url: 'items/load',
                            reader:
                            {
                                type: 'json',
                                root: 'data'
                            }
                        }
                    }),
            tpl: Ext.create('Ext.XTemplate',
                    '<tpl for=".">',
                        '<div class="x-boundlist-item">{key item} - {description}</div>',
                    '</tpl>'),

            displayTpl: Ext.create('Ext.XTemplate',
                                    '<tpl for=".">',
                                        '{key item} - {description}',
                                    '</tpl>'
                                    )


        }


推荐答案

当请求加载存储时,它将传递值为5的pageSize查询参数。

When the request is made to load the store, it will pass a pageSize query parameter with value 5.

然而,由于您的服务器端服务在返回时考虑到此参数

However, it is up to your server-side services to take this parameter into account when returning results.

编辑:这是一个分页组合框的例子: http://docs.sencha.com/extjs/4.1.3/#!/example/form/forum-search.html

Here's an example of paging combobox: http://docs.sencha.com/extjs/4.1.3/#!/example/form/forum-search.html

如果您在Web开发控制台上打开网络选项卡,您将看到正在触发的请求,您可以查看查询参数。您可以根据需要发送其他人,但这对于基本的分页应该是足够的。

If you open the network tab on your web development console, you will see the request being fired and you can look at the query parameters. You can send others as necessary, but this should be more than enough for basic paging.

以下是发送的查询参数:

The following are the query parameters sent:

limit - 由pageSize参数设置(默认值为25)

limit - set by the "pageSize" parameter (default of 25)

start - 要返回的第一条记录(从0开始,递增)通过pageSize使用工具栏上的上一个/下一个按钮)

start - the first record to be returned (starts at 0 and is incremented by pageSize using the prev/next buttons on the toolbar)

页面 - 我们所在的页面(从1开始,并使用prev / next递减1)

page - the page we are on (starts at 1 and is decremented/incremented by 1 using the prev/next buttons on the toolbar)

查询 - 组合框中的文本。

query - the text in the combobox.

编辑2:
您还应该从您的服务器的回复中返回一个totalProperty,该服务器的结果总数。这将适当地更新工具栏(例如,您在y的第x页)。默认情况下,totalProperty预期为total。当您查看提供的示例中的代码时,您可以看到这一点。

EDIT 2: You should also be returning a "totalProperty" in your response from your server which has the total number of results. This will update the toolbar appropriately (e.g you are on page x of y). By default, the totalProperty expected is "total". You can see this when you look at the code in the example provided.

这篇关于Combobox分页工具栏不响应页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆