欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

EXTJS2.2组件Combobox-lovcombo多选框操作

程序员文章站 2022-07-13 22:44:28
...

Combobox-lovcombo多选框css和js文件见我的另一篇:https://blog.csdn.net/qq_37279783/article/details/88019873

组件:

    var reasonCatStore = new Ext.data.JsonStore({
        proxy: new Ext.data.HttpProxy({
            method: "POST",
            url: "<%=request.getContextPath()%>/problem_getDictByClassId.action?classId=CAUSECLASS"
        }),
        root: "rows",
        fields:['code','name'],
        id:"reasonCatStore"
    });
    //加载数据
    reasonCatStore.load();
    var reasonCat = {
        xtype : 'lovcombo',
        fieldLabel : '名称',
        labelSeparator : " ",
        id : 'reasonCat',
        displayField : 'name',
        valueField : 'code',
        store : reasonCatStore,
        mode : 'local',
        triggerAction : 'all',
        allowBlank:true,
        emptyText : '请选择...',
        readOnly : true,
        name:'reasonCode',
        hiddenName:'reasonCode',
        anchor : '30%',
        //鼠标失去焦点时,输入框为空时加入以下事件
        beforeBlur:function () {
            var val = this.getCheckedValue();
            var dsval = this.getCheckedDisplay();
            form_panel.getForm().findField("reasonCode").setValue(val);
            form_panel.getForm().findField("reasonCode").setRawValue(dsval);
        }
    };