Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
One scrollbar for two ultrawebgrids
posted

Hi all !

I'm in front of a problem : I got two webgrids vertically aligned in my page. The top grid has a horizontal scrollbar at the bottom. I want to make this scrollbar scrolling the two webgrids at the same time. I don't know how to do that because the webgrids don't have a scrolling event handler.

Could someone help me please ?

 

Bye

Parents
No Data
Reply
  • 2907
    posted

    Hi,

     

    You can try following.

    (1)   Setting scroll event handler to grid. Handle InitializeLayout event of grid1 in following way.

     

    function grid1_InitializeLayout(gridName)

    {

        var grid  = igtbl_getGridById(gridName);

        if(ig_shared.IsFireFox)

                {

                grid.getDivElement().addEventListener("scroll", GridScrolled, false);

                }

            else

                {

                grid.getDivElement().onscroll = GridScrolled;

                }

    }

     

    (2)   Handling the scroll event

     

    function GridScrolled()

    {

     var grid1 = igtbl_getGridById("grid1");

     var grid2 = igtbl_getGridById("grid2");

     grid2.getDivElement().scrollLeft = grid1.getDivElement().scrollLeft ;

    }

     

    I think that all other things are already managed like changing column width of any grid.

     

    Also note: You need a reference of html component which contains scrollbar. Usage of grid.getDivElement() in above code is valid for XMLLoadOnDemand = virtual. You may need to use some other way to get reference of the control showing scrollbar.

     

    Please let me know if this helps you.

Children