Auto-scroll to a column in a FrozenColumnCount grid?

4 posts, 0 answers
  1. John Fetherolf
    John Fetherolf avatar
    17 posts
    Member since:
    Sep 2008

    Posted 05 Mar 2012 Link to this post

    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)
  2. John Fetherolf
    John Fetherolf avatar
    17 posts
    Member since:
    Sep 2008

    Posted 06 Mar 2012 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Mar 2012 Link to this post

    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.
  5. John Fetherolf
    John Fetherolf avatar
    17 posts
    Member since:
    Sep 2008

    Posted 08 Mar 2012 Link to this post

    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)

Back to Top