tak więc zrobiłem @RemoteMethod i otrzymuje z niej Dto-sa
front wygląda tak :
<c:if test="${not empty app.copyingAssortmentReportId}">
<div id="before" class="msg-ok" style="display: block;">
Skopiowano <div id="progress"></div> z <div id="to-processed"></div>
</div>
<div id="after" class="msg-ok" style="display: none;">
Kopiowanie zostało zakończone. <a href="<c:url value='/raport/${app.copyingAssortmentReportId}' />">Pobierz raport</a>
</div>
</c:if>
<form id="submitCopying" action="${burl}" method="POST" class="iformat-copying-assortment-box" >
<div class="option-container">
<div class="iformat-copying-assortment-filter-option">
<div class="option-label">Dostawca źródłowy:</div>
<tg:AjaxAutoCombo id="fromSupplier" hideAfterAdd="true" width="${width+160}" />
</div><div class="cl"></div>
<div class="buttons-container">
<input class="button" type="button" onclick="checkProgress()" value="Rozpocznij proces kopiowania" />
</div>
</form>
<script type="text/javascript">
function checkProgress() {
setInterval(function () {
checkCopyAssortmentProgress();
}, 3000);
var form = $("#submitCopying");
form.submit();
}
function checkCopyAssortmentProgress() {
var reportRequestDto = { actionId: '${app.copyingAssortmentReportId}'};
GlobalActionsRemote.retrieveProgressDto(
reportRequestDto, {
callback : onRemoteCopyAssortmentActionSuccess,
errorHandler: onRemoteCopyAssortmentActionFailure
}
);
}
function onRemoteCopyAssortmentActionSuccess(response) {
if (response.error || !response.content) {
alert2("Wystąpił błąd podczas zapisywania danych.");
return;
}
var progressDto = JSON.parse( response.content );
document.getElementById('progress').innerHTML = progressDto.currentProgress;
document.getElementById('to-processed').innerHTML = progressDto.processPool;
if (progressDto.currentProgress === progressDto.processPool) {
document.getElementById('before').style.display == 'none'
document.getElementById('after').style.display == 'block'
}
}
function onRemoteCopyAssortmentActionFailure(errorMsg) {
alert2("Wystąpił błąd podczas zapisywania danych2.");
}
</script>
powiedzcie mi... dlaczego to nie działa ? na froncie nie podmieniają się divy... no chyba że "checkCopyAssortmentProgress()" odpalę sobie ręcznie z konsoli w przeglądarce... tak jakby w ogóle ten "setInterval" nie działał...