下拉框

1)创建一个jsonstore 初始化下拉框的数据
duty.dutyrole.dataload.storecombox = new Ext.data.JsonStore({
    id : "duty-dutyper-storecombox",
    url : rootPath + "/duty/dutyrole_getAll.action",
    root : "list",
    totalProperty : "totalSize",
    remoteSort : true,
    fields : ["dutyrolecode", "dutyrolename"],
    listeners : {
        load : function(store, records, options) {
            var record = new Ext.data.Record({
                        dutyrolecode : "",
                        dutyrolename : "请选择..."
                    }, "dutyrolecode");
            store.insert(0, record);
        }
    }
});
duty.dutyrole.dataload.storecombox.load();
2)引用store
hiddenName : "positioncode",
xtype : "combo",
store : duty.dutyrole.dataload.storecombox,
anchor : '90%',
triggerAction : "all",
typeAhead : true,
valueField : "dutyrolecode",
displayField : "dutyrolename",
readOnly : true,
allowBlank : false,
blankText : '该项为必选项',
mode : "local",
labelStyle : "text-align: right;",
fieldLabel : "<font color=red>*</font>职务"

你可能感兴趣的:(ext)