jeesite frame front end tabPage tab refresh function.

js js code initiative to refresh the current page signed
Originally looking at jeesite there is no built-in method proactive refresh the current page.
Find a lot of official documents, looking for can not be found, I may need this needs fewer people.
tab tab tab there is a right-refresh function

After viewing the compiled code, it can be found in the source code after the compiler front-end

$('.active .refresher').click() 

The official js script to call the built-refresh function.

But the existence of this script problem, only the first will trigger, and then after the operation to open the list or form interface, this method will fail.

Browser debugging found the back several times to obtain $ ( '. Active .refresher') elements are empty, get less.

 
As the preceding is not very familiar with the preceding paragraph did not want to waited a long time, finally found
Official function, JS . GetCurrentTabPage ( currentTabCallback ); callback parameter is the iframe contentWindow objects,
Think of the iframe refresh function.
Here is the js code to refresh the current page signed. Test can be used normally. 
There is a problem, if the page is a list of queries, call the following query will result in the loss of js. 
js.getCurrentTabPage (function (contentWindow) {
// reload the iframe window contentWindow.location.reload ( to true ); });

 

Get this problem, then the current page will refresh function can be achieved.
Process cup of water in the blowing wind, a problem occur.
Since this front-end frame using a plurality of interface iframe in that only the first to enter the interface in order to obtain the $ ( '. Active .refresher') corresponding to the selector element, some time after the user interface issues not obtain , it can be explained through.
Modal browser console. (For the first time to refresh the page, you can get to the html element, after operating for some time, need to use $ (selector, window.parent.document) .html () to retrieve the document content.

 

Therefore, the above method to refresh the current tab can be changed to the following refresh the code (js script calls the built-refresh the page, and in fact a kind of code above.)
$('.active .refresher',window.parent.document).click() 

Guess you like

Origin www.cnblogs.com/gne-hwz/p/11310975.html