XPages: Get the contents of a - this._partialRefresh AJAX call?

别等时光非礼了梦想. 提交于 2019-12-24 23:29:01

问题


I'm doing a partialrefresh of an XPage (Domino 8.5.1) but need to get the contents of the response.

The reason is that IE8 seems to (sometimes) have an issue with partial refreshed HTML not showing. I can see that the response is correct but the DOM isn't updated.

There's an easy fix for this:

div.innerHTML = div.innerHTML

But for me to apply this I need the content so I can insert it in the first place.

So, is it possible to get the returned HTML from a partialRefresh? Or is there another way to solve this?


回答1:


To hijack a partial refresh you can add this CSJS code:

// --- hijack dojo XHR calls
dojo._xhr = dojo.xhr; 
var loadOld;

function hijacked( response, ioArgs ){
   alert( response ); // change code here to do whatever you want. // 
   loadOld( response, ioArgs ); // call the original function 
}

dojo.xhr = function( mode, args, bool ){
    loadOld = args["load"];
    args["load"] = hijacked;
    dojo._xhr( mode, args, bool );
}

Just change the function "hijacked" to fullify your requirements.

Hope this helps

Sven

Edit: The method "hijacked" is executed BEFORE the changes to the DOM will be applied (and before OnComplete event)




回答2:


You can trigger a partial refresh as a client-side event:

XSP.partialRefreshGet("#{id:targetId}", {
    onComplete: function(responseData) {
        // examine the response content
    }
});

The onComplete function will be passed the response from the server, and you can parse or otherwise respond to the data within that function.



来源:https://stackoverflow.com/questions/9776503/xpages-get-the-contents-of-a-this-partialrefresh-ajax-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!