【问题标题】:Combobox query override组合框查询覆盖
【发布时间】:2013-06-17 17:47:43
【问题描述】:

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

{
    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

【问题讨论】:

    标签: extjs extjs4 extjs-mvc


    【解决方案1】:

    也许有一种不那么侵入性的方式来做你需要的事情,但这里是我如何解决一个类似的请求来拦截和覆盖发送到服务器的查询:

    从 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;
            }
        });
    }
    

    【讨论】:

    • 非常感谢!我通过listeners'beforequery':function(queryevent)... 解决了它,但要点是一样的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多