Ext加载下拉框得志

    技术2025-02-16  14

     

    var year_select = new Ext.form.ComboBox({ id : 'year_select', fieldLabel : "學年", hiddenName : "year", // 下拉框在 HTML 中显示的名称 allowBlank : false, width : 100, selectOnFocus : true, valueField : "store", // 提交表单时,下拉框的值 displayField : 'storeYear', // 显示在页面上下拉框的值 emptyText : '请选择..', editable : false, mode : "local", forceSelection : true, triggerAction : 'all', anchor : '85%', store : new Ext.data.JsonStore({ // 动态从后台提取数据并填充到 ComboBox autoLoad : true, fields : [{ name : 'store', type : 'int' }, { name : 'storeYear', type : 'int' }], url : '/erips/portfolio/srcs/getYears.htm', root : 'root', totalProperty : 'totalCount', successProperty : 'success', failure : function() { Ext.Msg.alert("數據加載失敗!請檢查"); } }, []), typeAhead : true, listeners : { select : function(combo, record, index) { alert(combo.value); } } });

    其中从controller中得到的值为:{"success":true,"totalCount":1,"root":[2009]}

     

     

    var combo = new Ext.form.ComboBox({ width:127, height:50, renderTo:'div_com', mode:'remote', triggerAction:'all', id:'filiale', name:'filiale', value:'请选择..', allowBlank: false, handleHeight:5, listWidth :150, maxHeight:100, readOnly:true, valueFiled:'fid', displayField:'title', store:new Ext.data.JsonStore({ url: '../../MyPages/Colligate/UploadFiliale.aspx?id='+encodeURI(v), root: 'data', fields: ['title','fid'] }), listeners:{ 'select':function(arg){ var d = arg.value; alert(Ext.get("filiale").dom.value); alert(Ext.getCmp("filiale").getValue()); } } });

     

    最新回复(0)