Jsf使用Extjs中的loadMask实现页面等待效果

本文介绍了一种使用Ext等待对话框的方法,通过在按钮点击事件中展示遮罩直至服务器响应来提升用户体验。该方法适用于AJAX请求场景,通过简单的JavaScript代码实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

         Introduce a technology to use Ext waiting dialog for better user-friendly. Please see the following picture. When click a button, a mask will be shown until get response from server. This is AJAX feature. 

 

 

 

 

How to use it? Just add two method into the button’event

 

 

JavaScript:

 

<link
   href="#{seamRequest}/resources/ext/ext/resources/css/ext-all.css"
   rel="Stylesheet" type="text/css" />
  <script
   src="${facesContext.externalContext.requestContextPath}/resources/ext/ext/ext-base.js"
   type="text/javascript"></script>
  <script
   src="${facesContext.externalContext.requestContextPath}/resources/ext/ext/ext-all-debug.js"
   type="text/javascript"></script>
  <script>

frm_mask_obj=null;
 
function click_open(option){

  if(Ext.isEmpty(frm_mask_obj)) {
     frm_mask_obj=new Ext.LoadMask(Ext.getBody(),{msg:'plese wait for a while'});
  }
  Ext.apply( frm_mask_obj, option);
  frm_mask_obj.show(); 
};

function click_close(){
  if(!Ext.isEmpty(frm_mask_obj)) {
    frm_mask_obj.hide();
  }
};

</script>

页面代码:

 

<a4j:commandButton id="quot_input_save_input" value="Save"

         action="#{inputBean.save}" style="width:70px"

         data="#{inputBean.allMessages}"

         binding="#{inputBean.saveButton}" ajaxSingle="false"

         onclick="frm_loadMask({msg:'Save quotation,please wait!!'})"

         oncomplete="frm_closeMask();checkValidationMessage('form_input');showResponseMessages(data);"

         reRender="panel_all"

         rendered="#{talui:checkSecurityForUiComponent('quot_input_save_input',2)}"

         disabled="#{!talui:checkSecurityForUiComponent('quot_input_save_input',1)}" />

 

 

please take note

1)     onclick="frm_loadMask({msg:'Save quotation,please wait!!'})"
call frm_loadMask, and the parameter “msg” is the waiting-text

2)     oncomplete="frm_closeMask();"
call frm_closeMask to hide the mask

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值