cartonwang 2010-06-08 15:01
浏览 276
已采纳

EXTJS2.0,项目中增加一个简单需求,新加一个下拉框选中数据后显示在原有的文本域中

小弟初时EXTJS,项目中碰到一个小问题,就是要增加一个下拉框,选中里面的数据后,显示在文本域中,不知道怎么写,写了多次都报EXT-all-dub.js的错误。
附件中有关于这个操作的图片。。。谢谢了。
原代码:

xtype:"window",
 title:"任务派遣",
 width:500,
 modal:true,
 height:400,
 layout:"fit",
 initComponent: function(){
  orgWindow = new HM.orgWindow({rootId:this.rootOrg, withUser:false,rootText:this.rootOrgText,singleSelect:true,onSave:function(o){
    this.form.getForm().findField("sendOrg").setValue(o.tree.getValue());
    this.form.getForm().findField("_sendOrg").setValue(o.tree.getValue("text"));
    o.hide();
   }.createDelegate(this)
  });
  orgWindow2 = new HM.orgWindow({rootId:this.rootOrg, withUser:false,rootText:this.rootOrgText,onSave:function(o){
    this.form.getForm().findField("assistOrg").setValue(o.tree.getValues());
    this.form.getForm().findField("_assistOrg").setValue(o.tree.getValues(null,"text"));
    o.hide();
   }.createDelegate(this)
  });
  this.form = new Ext.form.FormPanel({
      xtype:"form",
      title:"",
      labelWidth:80,
      labelAlign:"right",
      layout:"form",
      region:"center",
      items:[{
        xtype:"hidden",
        name:"sendOrg"
       },{
        xtype:"hidden",
        name:"assistOrg"
       },{
        layout:"column",
        anchor:"100%",
        items:[{
         layout:"form",
         columnWidth:.85,
         items:[{
          xtype:"textfield",
          fieldLabel:"主办部门",
          allowBlank:false,
          name:"_sendOrg",
          readOnly :true,
          anchor:"95%",
          listeners:{
           focus:orgWindow.show.createDelegate(orgWindow)
          }
         }]
         },{
          columnWidth:.12,
          items:[{
           xtype:"button",
           text:"选择",
           //icon:rootPath + '/images/commons/orgempty.png',
           handler:function(){orgWindow.show()}
         }]
        }]
       },{
        layout:"column",
        anchor:"100%",
        items:[{
         layout:"form",
         columnWidth:.85,
         items:[{
          xtype:"textfield",
          fieldLabel:"协办部门",
          name:"_assistOrg",
          readOnly :true,
          anchor:"95%",
          listeners:{
           focus:orgWindow2.show.createDelegate(orgWindow2)
          }
         }]
         },{
          columnWidth:.12,
          items:[{
           xtype:"button",
           text:"选择",
           //icon:rootPath + '/images/commons/orgempty.png',
           handler:function(){orgWindow2.show()}
         }]
        }]
       },
       {
       
        xtype:"textfield",
        fieldLabel:"派遣常用语",
        name:"habitwords",
        anchor:"95%",
        height:20
       
       },
       {
        xtype:"textarea",
        fieldLabel:"派遣意见",
        maxLength:500,
        name:"opinion",
        anchor:"95%",
        height:200
       },
       {
        xtype:"datefield",
        fieldLabel:"完成截止时间",
        allowBlank:false,
        format : 'Y-m-d H:i',
        menu:new DatetimeMenu(),
        name:"rollEndTime",
        anchor:"95%"
       }
      ]
     });
  this.items=[
   {
    xtype:"panel",
    title:"",
    autoScroll:true,
    frame:true,
    layout:"border",
    items:[
     this.form
    ]
   }
  ];
  this.buttons = [{
   text:"确定",
   handler:function(){
    if(this.form.getForm().isValid()){
     if(this.form.getForm().findField('rollEndTime').getValue().getTime()<new Date().getTime()){
      Ext.Msg.alert("提示", "完成截止时间不能早于当前时间!");
      return;
     }
     this.submit();
    }
   },
   scope:this
  },{
   text:"关闭",
   handler:function(){
    this.hide();
   },
   scope:this
  }]
  HM.workflow.sendWindow.superclass.initComponent.call(this);
 }

  • 写回答

1条回答 默认 最新

  • upup1000 2010-06-08 16:45
    关注

    那你就新加一个下拉框呗,加一个select监听,把value设置到相应的表单中就可以了

    combo必须指定一个Ext.data.Store对象或其子类的对象(或数组),必须指定displayField和valueField

    {
    xtype:"combo",
    store:store,
    displayField:"text",
    valueField:"text",
    name:"combo",
    fieldLabel:"",
    triggerAction:"all",
    listeners : {
    select : function(v){
    this.form.getForm().findField("xxx").setValue(v);
    },
    scope : this
    }
    }

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划