-1

您好,我正在尝试在组合框中进行搜索。它正在工作,但仅在当前页面中搜索

任何建议


{
    xtype: 'combo',
    fieldLabel: 'Organization Id',
    name: 'company_id',
    displayField:'name_en',
    valueField:'id',
    store: Ext.create('UserApp.store.PicklistList', {
        autoLoad: true,
        fields: ['id', 'name_en', 'name_se'],
        proxy:{
            type:'ajax',
            api: {
                read:'picklist/listitems'
            },
            reader: {
                type: 'json',
                root: 'root',
                successProperty: 'success'
            },
            extraParams:{
                table :'table_name'
            }
        }
    }),
    editable: true,
    autoSelect: false,
    selectOnFocus:true,
    typeAhead:true,
    minChars:2,
    queryMode: 'local',
    mode: 'local',
    pageSize: 25,
    width:370,
    allowOnlyWhitespace: false,
    regex: /[a-zA-Z0-9]+/, // avoid to empty data only
})
4

2 回答 2

0

我正在使用带有 queryMode 的组合框:'remote',并使用组合框搜索匹配项。我正在执行“包含”搜索——这意味着它不仅会在结果字符串中的任何位置查找匹配项,而且还会在当前页面和整个结果集中搜索值。我正在使用 extjs 4.0.7,并通过覆盖 doQuery 方法来实现它。

`doQuery: function(queryString, forceAll) { this.expand(); this.store.clearFilter(!forceAll);

    if(this.queryMode == 'remote') {
        this.store.load({
            params: this.getParams(queryString)
        });
    }
    if (!forceAll) {
        this.store.filter(this.displayField, new RegExp(Ext.String.escapeRegex(queryString), 'i'));
    }
}`
于 2013-07-03T02:09:47.520 回答
0
  1. 您的商店需要设置分页

  2. 您的服务器需要根据从商店代理接收的参数正确处理分页。代理将发送查询字符串参数,例如?page=1&start=0&limit=25,您的服务器只需要返回 25 条(例如)记录和一个总参数。

    {"total":101,"data":[{model data}, {model data}, ...]}

  3. 尽管有文档,combobox 中的 pageSize 属性实际上是一个布尔值,如果为 1 或更大,则打开分页。

于 2013-06-26T20:56:38.080 回答