This is a migrated thread and some comments may be shown as answers.

Auto scroll not working on RadPanelBar

3 Answers 99 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Mohamed
Top achievements
Rank 1
Mohamed asked on 11 Nov 2010, 11:06 AM
Hey,
I have a left had side menu control that uses PanelBar, it maintains its state between postbacks by this javascript code:

<script type="text/javascript">
    function pageLoad() {
        var currentUrl = window.location.href.toLowerCase();
        var panelbar = $find("<%= tlrkNavigationPanel.ClientID %>");

        var currentItem = null;
        var currentItemTemp = null;
        for (var i = 0; i < panelbar.get_allItems().length; i++) {
            if (panelbar.get_allItems()[i].get_linkElement() &&
            currentUrl.indexOf(panelbar.get_allItems()[i].get_linkElement().href.toLowerCase()) > -1) {
                currentItem = panelbar.get_allItems()[i];
                currentItemTemp = currentItem;
                break;
            }
        }

        while (currentItem && currentItem.get_parent() != panelbar) {
            currentItem.get_parent().expand();
            currentItem = currentItem.get_parent();
        }

        if (currentItemTemp) {
            currentItemTemp.select();
            currentItemTemp.expand();
        }
    }    
</script>

After moving to the new page it highlights the selected item and expand the menu, but if the selected item is not visible because the menu height exceeds the visible range, I need to scroll to view the selected item. Can anyone tell me how to make it auto scroll to the selected item
Thanks and best regards,

3 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 16 Nov 2010, 01:41 PM
Hello Mohamed,

Could you, please, try the following:
panelItem.get_elememt().scrollIntoView();
and let me know how that worked for you?

I hope this will solve the problem!


Regards,
Nikolay Tsenkov
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Mohamed
Top achievements
Rank 1
answered on 20 Nov 2010, 11:08 AM
Thanks Nikolay for your reply,
I tried this solution but unfortunately it didn't work with me.
Here is my code:

if (currentItemTemp) {

                currentItemTemp.select();
                currentItemTemp.expand();
                currentItemTemp.get_element().scrollIntoView();
            } 
0
Peter
Telerik team
answered on 25 Nov 2010, 10:04 AM
Hi Mohamed,

Can you try setting PersistStateInCookie="true" instead of using a javascript workaround?


All the best,
Peter
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
PanelBar
Asked by
Mohamed
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Mohamed
Top achievements
Rank 1
Peter
Telerik team
Share this question
or