jQuery UI Widgets › Forums › TreeGrid › Event on TreeGrid/Grid Scrollbar
Tagged: treegrid component, treegrid control
This topic contains 9 replies, has 2 voices, and was last updated by Klaus H 10 years, 6 months ago.
-
Author
-
Hi,
I have two grids on a page, a TreeGrid and a normal Grid. The data of the two grids are connected. Due to the number of columns, the grids are wider than the screen. What I want to achieve is to synchronize the two grids, if a user scrolls via the horizontal scrollbar.
I looked in the API, and there seems to be no designated way to get to the scrollbar of a TreeGrid/Grid.
I checked the DOM and there are two divs with the id: horizontalScrollBar + name of the respetive Grid.
I have added to my script a check if the div with the id does exist and then attached the value changed event to it. I see that the event seems to be initialized, but it is never fired.
Could you tell me if what I want to achieve is possible and if so, what’s the right way?
Kind Regards
KlausHi Klaus,
The “scrollOffset” method can be used for scrolling. Example: http://jsfiddle.net/jqwidgets/2TEGt/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHello Peter,
and how can I get the information/event if a user scrolls in one of the grids?
Kind Regards
KlausHi Klaus,
There is no Event about that and I am afraid that we do not plan to add.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHello Peter,
yes, I understand that, but can’t I use the scrollbars from the Grid as jqxScrollbar Objects? They seem to be initialized as such, but if I use the id: horizontalScrollBartreegrid for example, no event is fired from it.
What I can do is use the setPosition function of the Scrollbar on both the Grid and the TreeGrid, but then again, my event listeners I attached to them do not trigger. I assume there has to be a possibility to attach the valuechanged event on those scrollbars. Or is it something like the scrollbars are created new with each rendering of the grid and I would have to attach the event in the rendered function of the Grid?
Kind Regards
KlausHi Klaus,
There’s no API for what you’re looking for and as there is not API, then you can’t use it. The scrollbars in the Grid are indeed jqxScrollbar, but their events are already handled and are not propagated to the DOM so you can’t use these events. Sorry, about dissapointing you, but we just don’t have such kind of functionality.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHello Peter,
thank you for the clarification, I understand your reasoning and I’m glad I know the reason now and not disappointed. 🙂
Kind Regards
KlausI have found a workaround – since the grid is under the treegrid, I have surpressed the display of horizontal scrollbar of the treegrid and the header of grid. I then use this method to know when a user is scrolling the grid:
http://www.jqwidgets.com/community/topic/scroll-event/And use the setPosition method of the undisplayed scrollbar. That works fine with a slight delay, but the scrolling method of the Grid is not in the API – is there a reason for that like it is deprecated or would it be safe to use this?
Kind Regards
KlausHi Klaus,
There is no scrolling method neither in jqxGrid or jqxTreeGrid. Dimitar has shown a workaround using an internal property and we cannot guarantee that we will not make changes about this in the future.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHello Peter,
thank you very much for that clarification. As for now, I will take my chances with this one.
Kind Regards
Klaus -
AuthorPosts
You must be logged in to reply to this topic.