AJAX-reload of scrollable Sheets resets scrollbar to top position
-----------------------------------------------------------------
Key: TOBAGO-229
URL: https://issues.apache.org/jira/browse/TOBAGO-229
Project: MyFaces Tobago
Issue Type: Bug
Reporter: Dennis Hauser
A workaround could be to store the scrollbar position before reloading and to
set it to the original after the reload is completed ( see attached code
fragment exchange-energy-trade_win.js)
This does work theoretically, but the marked lines in the second code fragment
(tobago-sheet.js) are resetting the sheet completely again.
-------------
exchange-energy-trade_win.js
function eetReloadOverviewWin() {
// -------- neu von hier--------
var dataDiv = Tobago.element("marketPage:overviewSheet_data_div");
var scrollTop = dataDiv.scrollTop;
var scrollLeft = dataDiv.scrollLeft;
// -------- bis hier --------
var options = {
insertion: function(receiver, response) {
if (response.substring(0, 20) == "<status code=\"304\"/>") {
// no update needed, do nothing
receiver.skipUpdate = true;
} else if (response.substring(0, 11) == "<input id=\"") {
// update content
Element.update(receiver, response);
// -------- neu von hier--------
var dataDiv2 = Tobago.element("marketPage:overviewSheet_data_div");
dataDiv2.scrollTop = scrollTop;
dataDiv2.scrollLeft = scrollLeft;
// -------- bis hier --------
} else {
// unknown response do full page reload
LOG.debug("initiating full reload");
var mos = Tobago.element("marketPage:overviewSheet");
if (mos != null) {
Tobago.submitAction("marketPage:overviewSheet");
}
}
if (eetOverviewTimeoutWin) {
clearTimeout(eetOverviewTimeoutWin);
}
eetOverviewTimeoutWin = setTimeout(eetReloadOverviewWin,
eetGetConfigWin().overviewSheetReloadTimeout);
},
createOverlay: false
};
Tobago.reloadComponent("marketPage:overviewSheet",
"marketPage:overviewSheet", options);
}
-------------
resources/html/standard/standard/script/tobago-sheet.js
Tobago.Sheet.prototype.setup = function() {
...
// Problematisches Codefragment, dessen Sinn mir sich nicht erschließt,
// dessen Auskommentierung jedoch das Problem löst. :-)
// -------- von hier --------
// ToDo: find a better way to fix this problem
// IE needs this in case of ajax loading of style classes
var outerDiv = Tobago.element(this.outerDivId);
outerDiv.className = outerDiv.className;
outerDiv.innerHTML = outerDiv.innerHTML;
// -------- bis hier --------
...
}
-------------
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira