Incorrect popup shadow position after moving popup in RichFaces 4.x

倖福魔咒の 提交于 2019-12-08 05:22:55

问题


I have popup with autosized attribute. Panel contains fields for search, search button, datatable and datascroller. After press search button or select page in datascroller javascript is called. Javascript is used for move popup to center of browser visible area. All work fine, except popup shadow is stay for previous panel position when popup is already moved.

Button code:

<a4j:commandButton id="searchButton"
    value="#{msg.search}"
    action="#{chAction.searchSegments}"
    styleClass="richButton"
    render="clientCategoryCandidateTable"
    oncomplete="centerPanel();" />

Javascript:

function centerPanel() {
    var modalPanel = #{rich:component('addToSegmentsPanel')};
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupWidth = modalPanel.width();
    var popupHeight = modalPanel.height();
    modalPanel.setLeft(Math.max(0, (windowWidth-popupWidth)/2));
    modalPanel.setTop(Math.max(0, (windowHeight-popupHeight)/2));
};

I have tried different version of javascript, but with same side effect:

function centerPopup() {
    var popup = #{rich:component('addToSegmentsPanel')};
    popup.moveTo(Math.max(0, (window.innerWidth-popup.width())/2),
                 Math.max(0, (window.innerHeight-popup.height())/2));
};

Screen shots:

Thanks for any help or comments.


回答1:


Problem was fixed with adding hide and show in end of javascript:

modalPanel.hide(); modalPanel.show();



回答2:


I resolved the problem on calling resize () action of the popup. In your case, it should be modalPanel.resize().



来源:https://stackoverflow.com/questions/19570194/incorrect-popup-shadow-position-after-moving-popup-in-richfaces-4-x

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