您的位置:首页 > 其它

楼主最近遇到一个需求就在在ext 框架里实现右下角弹框提示,就自己动手做了一个

2017-10-25 13:27 525 查看
function loadData(){
var obj={};
/*obj.userId=userId;*/
obj.messageState=0;
Ext.Ajax.request({
url : 'system/queryListNP_message.action', // 请求地址 
method : 'POST',
// 提交参数组
params : {
jsonString : Ext.encode(obj)
},
// 成功时回调
success : function(response, options) {
// 获取响应的json字符串
var jsonString = Ext.decode(response.responseText).jsonString;
var list = Ext.decode(jsonString);
if(list.length>0){
var htmlStr='<table id="messageTable">';
for(var i=0;i<list.length;i++){
htmlStr+='<tr id="message_'+list[i].messageId+'">';
htmlStr+='<td><a href="javascript:goToAskList('+list[i].messageId+');" style="color: #2e86b6; text-decoration: none">'+list[i].messageTitle+'</a></td></tr>';

}
htmlStr+='</table>';

 if (tipWin) {
 tipWin.update('<center>'+htmlStr+'</center>');//面板存在就更新面板里面的提示消息
       }else{
    tipWin = Ext.create('oa.ux.Notice', {  //创建消息面板

                    title : '消息',  

                    width : 190,  

                    height : 100, 

               stickWhileHover: true,
   autoScroll: true,

                    html: '<center>'+htmlStr+'</center>'  

                });
       }

                tipWin.show();  
}else{
if (tipWin) {
tipWin.hide();
      }
}

},
failure : function(response, options) {
}
});
}

需要注意的是 因为在ext 中所以首先要把js引入进来,一般是这种方式

requires : [
'oa.ux.Vtype', 
'oa.ux.Notice', //需要引入的js 原名叫做Notification.js
'oa.util.Power',
'oa.util.DES3',
'oa.util.Encrypt',
'oa.CommonAndLoadFirst', // 最先加

使用的时候也要用这种方式
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐