Hi,
I have a tree grid and functionality to apply scroll on row drag and if the mouse is left stationary at the bottom of the grid the scrolling stops.
The mouse has to be in motion and has to be moved up and down to keep scroll going.
Is there any way that scrolling doesn't stop even the mouse is left stationary?
Thanks,
Mani
Hello Mani,
Thank you for posting in our community.
I have created a sample, trying to reproduce the describe behavior. I am using the approach of the last example that have been shared in this forum thread. On my side everything works as expected and the view of the grid can be scrolled if the mouse is left stationary.
Please test the sample on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated, please feel free to provide your own isolated sample, where the issue is reproducible. Please keep in mind to remove any dependencies and code that is not directly related to the issue.
Having a sample, which I can debug on my side, will be highly appreciated and extremely helpful for providing you with solution as soon as possible.
Thank you for your cooperation.
Looking forward to hearing from you.
Regards,Viktor KombovEntry Level Software DeveloperInfragistics, Inc.
Hello Viktor,
Even from the sample you provided the scroll is not freely moving.
If we drag the row to the bottom of the page and hold the mouse without moving and not leaving the dragged item the scroll is not smooth and some kind of mouse movement is required in order to achieve the scroll.
Can you please verify that and let me know? Meanwhile I will try to get you a sample from my side.
Thank you,
I am glad that you find this suggestion helpful!
Thank you for choosing Infragistics components!
I found it very helpful as Creating a Loop in the scroll grid function made scrolling much easier for my scenario.
Thank you Once again!
Regards,
The reason for the described behavior is that the scrolling is implemented in the handler of dragMove event, which is emitted only when the mouse is moved. In order to automatically scroll the grid, I would suggest you creating a loop in the scrollGrid method, which will be executed when the dragged row reaches the edge of the grid and will do its job until the row is being returned to the body of the grid or being dropped:
// TypeScript public scrollGrid(dir: number) { ... const interval = setInterval(() => { if (this._toScroll && !this.isScrolledToEdge()) { if (dir === 1) { this.treeGrid.verticalScrollContainer.scrollPosition += this._rowHeight; } else { this.treeGrid.verticalScrollContainer.scrollPosition -= this._rowHeight; } } else { clearInterval(interval); } }, 50); }
I have updated the previously provided sample illustrating my suggestion. Please test it on your side and let me know whether you find it helpful.