function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
baseball123baseball123 

Stop the scrollbar moving

I have a visualforce page that everytime changes the date of each line item, after price recalculation, the scrollbar will always move to the top. If there are a lot of line items on the page, it becomes annoying after change the date of each line item. Any idea how to stop the scrollbar moving after price recalculation and just let the scrollbar stay where it is? The following is the code for the field. 

 

<apex:column headerValue="End Date">
<apex:outputPanel style="display: inline-block;">
<apex:inputField id="filteredInventoryItemEndDate" value="{!i.inputProxy.EndDate__c}">
<apex:actionSupport event="onchange" action="{!recalculatePriceAction}" rerender="filteredInventoryPageBlock" status="priceRecalculationStatus" onsubmit="disable_buttonAll();" oncomplete="enable_buttonAll();">
<apex:param assignTo="{!selectedResultItemIndex}" value="{!i.index}" name="selectedResultItemIndex"/>
</apex:actionSupport>
</apex:inputField>
</apex:outputPanel>
</apex:column>

 

Thanks in advance.

_Prasu__Prasu_
Complete page might be getting rerendered and that causing the scrollbar moving to top. Try to rerender only the partial part which is actually needed to reflect the changes. And that should solve your problem.
baseball123baseball123

Thanks for your suggestion. If the page display 30 olis from top to buttom, after user changes the date for the 25th line item, the price recalculation kicks in, how can I tell the program only to rerender to the 25th line item instead of the entire page block?