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

Auto-scroll to a column in a FrozenColumnCount grid?

3 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John Fetherolf
Top achievements
Rank 1
John Fetherolf asked on 05 Mar 2012, 04:13 PM
I am working on an internal payroll application.  I have a grid with essentially 25 columns.  The first column is frozen and contains a row description of different pay types.  The other 24 are basically semi-monthly pay periods in a pay plan.  I want to "auto-scroll" the grid horizontally to the current pay period column (it varies when reloading plans ... sometime it may be column #1 ... sometimes #13 ... etc).  If anyone could point me to an example of how to accomplish this, I would greatly appreciate it.

Thanks,
Kevin M. Betts
Lead Microsoft Developer
Kimball Midwest
(not really John Fetherolf)

3 Answers, 1 is accepted

Sort by
0
John Fetherolf
Top achievements
Rank 1
answered on 06 Mar 2012, 10:55 PM
Sorry for the bump, but I was really hoping someone here could help me with this feature.  I have tried everything I could think of but no luck so far...

Thanks
Kevin
0
Pavlina
Telerik team
answered on 08 Mar 2012, 03:39 PM
Hi John,

To achieve your goal you could try setting fixed widths to your columns and then depending the position of current pay period column move the horizontal scroll. You could use the code snippet below as a starting point in achieving the desired functionality:
var frozenCont = document.getElementById('RadGrid1_Frozen');
var columnWidth = 200;
function scrollToMonth (index)
{
  frozenCont.scrollLeft = index * columnWidth;
}

Kind regards,
Pavlina
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
John Fetherolf
Top achievements
Rank 1
answered on 08 Mar 2012, 07:57 PM
Pavlina,

Thanks for the reply and for the help.  This does indeed work. 

Actually I tried it this way first but didn't notice a typo in my javascript ... dang it :)

Kevin M. Betts
Lead Microsoft Developer
Kimball Midwest
(not really John Fetherolf)

Tags
Grid
Asked by
John Fetherolf
Top achievements
Rank 1
Answers by
John Fetherolf
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or