Combobox查询覆盖

时间:2013-06-17 17:47:43

标签: extjs extjs4 extjs-mvc

如何使用查询值和当前组合框名称返回? 我有远程商店的组合框。

{
    xtype: 'combobox',
    fieldLabel: 'Some label',
    editable: false,
    name: 'my_combo',
    matchFieldWidth: false,
    displayField: 'foo',
    mode: 'remote',
    store: 'fooStore',
    valueField: 'foo2'
}

目前它返回带有参数的网址

query=my%20search
page=1
start=0
limit=25

如何返回

query=[{'my_combo':'my search'}]
page=1
start=0
limit=25

1 个答案:

答案 0 :(得分:2)

可能有一种不那么干扰的方式来做你需要的,但这里是我如何解决一个类似的拦截和覆盖发送到服务器的查询的请求:

从Ext.form.field.ComboBox扩展的自定义字段定义

initComponent:function () {
    this.on({
        beforequery:function(queryEvent){
            if (queryEvent.query)     {
                //uppercase typed in value
                queryEvent.query = queryEvent.query.toUpperCase().replace(" ","","g"); //.trim(); --errors out in IE9 compat mode
                queryEvent.combo.setValue(queryEvent.query);
            }
            Ext.Ajax.abortAll(); //cancel any previous requests
            return true;
        }
    });
}
相关问题