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
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.
Hi HBA,
Thanks for your reply. Your solution seems really good, I'm trying to implement it in my project.
But, as you said, Usage of grid.getDivElement() doesn't work. I'm looking for another way to get the reference of the control showing scrollbar.
I will inform you on my progress.