当前位置: 代码迷 >> JavaScript >> extjs下拉框+表单解决思路
  详细解决方案

extjs下拉框+表单解决思路

热度:203   发布时间:2012-04-13 13:50:24.0
extjs下拉框+表单
extjs页面上点击按钮,弹出下拉框+表单和"提交""取消"按钮,其中下拉框中的值是固定的,如何实现,如下效果
HTML code

<select>
 <option>1111111</option>
 <option>2222222</option>
 <option>3333333</option>
<select>
<input type=text>
<input type=button value=提交>&nbsp;
<input type=button value=取消>



------解决方案--------------------
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script>
var oForm, oForm1, oWin;
var n=0;
Ext.onReady(function(){
    oForm    = new Ext.FormPanel({
        renderTo:"form_panel",
        layout:"form",
        hideLabels:false,
        border:false,
        labelAlign:"right",
        labelWidth:70,
        items:[
            {xtype:'button',text:'click',listeners:{
                click:function(){
                    oWin.show();
                }
            }}
        ]
    });
    oForm1    = new Ext.FormPanel({
        renderTo:"form_panel",
        layout:"form",
        hideLabels:false,
        border:false,
        labelAlign:"right",
        labelWidth:70,
        items:[
            {fieldLabel:"选项",id:'sel_xx',name:"sel_xx",xtype:'combo',store:[[1,'111111'],[2,'222222'],[3,'33333']],editable:false,hiddenName:'xx',forceSelection:true,mode:'local',triggerAction:'all',value:'1'}
        ],
        buttonAlign:'center',
        buttons:[
            {xtype:"button",text:"递交",cls:'pad',formBind:true,handler:function(){oForm1.submit();}},
            {xtype:"button",text:"取消",cls:'pad',formBind:true,handler:function(){oWin.hide();}}
        ]
    });

    oWin = new Ext.Window({
        applyTo:'win_pad',
        layout:'fit',
        width:450,
        autoHeight:true,
        closeAction:'hide',
        plain:true,
        items:oForm1
    });

});

</script>
<div id="form_panel"></div>
<div id="win_pad"></div> 
  相关解决方案