|
I got it working in the
meantime. I bound the hidden field to
a component of my bean and got access to the submitted values. Now I can remember the position
of the div-scrollbar. If anybody is interested,
here is the code: <h:inputHidden
id="yscroller" binding="#{MyBean.docDivYScroller}"/> <script type="text/_javascript_"> var yscroll = document.getElementById('docform:yscroller'); var docsdiv = document.getElementById('docsdiv'); function setFocus(){ if (docsdiv!=null) { docsdiv.scrollTop=yscroll.value; } } function rememberScrolling() { if (docsdiv!=null) { yscroll.value = docsdiv.scrollTop; } } </script> MyBean; private HtmlInputHidden
docDivYScroller; From:
Hi all, I need some assistance with a custom autoscroll
function and immediate links. My page contains a datatable inside a scrollable div
tag. When the page is entered again I want to scroll back to
the last position inside the div (e.g. the last selected row). This is working so far. But when the page is submitted with an immediate link
I can't access the new yscroll value in my backingbean. Can I use a t:updateActionLister tag inside the
t:commandLink and set it’s value to the value of yscoll via JS ? Here are some snippets: <h:form id="docform"
true;" >
<h:inputText id="yscroll" value="#{MyBean.yscroll}"
/>
<t:div id="docsdiv" forceId="true">
<t:dataTable id="doclist"
<t:commandLink actionListener="#{MyBean.showDetail}"
value="#{MyBean.cellValue}"
immediate="true">
...
</t:commandLink>
...
<script type="text/_javascript_"> var yscroll =
document.getElementById('docform:yscroll');
function rememberScrolling() { var docsdiv =
document.getElementById('docsdiv'); yscroll.value = docsdiv.scrollTop; } </script> Has anybody an idea ? I know this is working with the autoscroll attribute
and the outer scrollbar of the browser. Thanks for any help Michael |

