extjs设置弹出窗口

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 17:31   2336   0

在使用extjs时,点击一个按钮或链接,弹出一个窗口:

这里的例子弹出一个图片窗口。

按钮或超链接直接调用pictureWin(path);方法

function pictureWin(path){
 formWindow = newPictureWin(path);
 formWindow.show();
}
//图片窗口
function newPictureWin(path){
 var picForm = new Ext.form.FormPanel({
  labelAlign : 'right',
  fileUpload : true,
  border : false,
  frame : true,
  autoScroll : true,
  layout : 'fit',
  items : [{
   border : false,
   autoScroll : true,
   html:"<image src='"+((jt.webContextRoot+
     "siteStaffMgt/findPicture.action?pictureName="+encodeURI(encodeURI(path)))
     ==""?"../images/img/login-bg.jpg":(jt.webContextRoot+
     "siteStaffMgt/findPicture.action?pictureName="+encodeURI(encodeURI(path))))+"'/>"
  }]
 });
 var window = new Ext.Window({
  title : '查看图片',
  width : 1000,
  height : 450,
  resizable : false,
  plain : false,
  frame : true,
  border : false,
  modal : true,
  constrainHeader : true,
  autoScroll : true,
  formPanel : picForm ,
  form : picForm .form,
  closeAction : 'hide',
  items : [ picForm  ],
  listeners : {
   beforeHide : function(){
    formWindow.show();
   }
  },
  buttons : [{
   text : '关闭',
   handler : function(){
    window.hide();
   }
  }]
 });
 return window;
}

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP