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

[Solved] Set RadGrid horizontal scroll position

2 Answers 301 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 03 May 2013, 02:09 PM
I have a RadGrid with horizontal scrolling.  On the initial load, I wish to have the position set to the far right.  How do I set this position?

2 Answers, 1 is accepted

Sort by
0
Accepted
Venelin
Telerik team
answered on 08 May 2013, 01:38 PM
Hi Matt,

Here is one possible approach to do that.

ASPX:

<ClientSettings>
    <ClientEvents OnGridCreated="onGridCreated" />
</ClientSettings>

JavaScript:
function onGridCreated(sender, args)
{
    if (typeof sender.ClientSettings.Scrolling.AllowScroll == "undefined")
    {
        return false;
    }
 
    var gridID = sender.get_id();
    var dataDiv = sender.get_masterTableView().get_element().parentNode;
    var maxScrollWidth = dataDiv.scrollWidth - dataDiv.clientWidth;
 
    if (sender.ClientSettings.Scrolling.FrozenColumnsCount)
    {
        $get(gridID + '_Frozen').scrollLeft = maxScrollWidth;
    }
    else
    {
        dataDiv.scrollLeft = maxScrollWidth;
    }
}

You can find a sample page in the attached archive. I hope this helps.

All the best,
Venelin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Matt
Top achievements
Rank 1
answered on 08 May 2013, 05:19 PM
That worked.  Thank you.
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Venelin
Telerik team
Matt
Top achievements
Rank 1
Share this question
or