2

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

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

目前它返回带有参数的url

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

如何返回

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

1 回答 1

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;
        }
    });
}
于 2013-06-17T22:52:39.597 回答