Search code examples
javascriptapache-flexbrowserflex4

How to stop the browser window from scrolling when I scroll a spark Datagrid in Flex 4?


I have a spark DataGrid which has more rows than its size. I want to use the mouse scroll to scroll the DataGrid, but when I do, the whole browser window also scrolls.

Is there a way to stop the browser scrolling when I just want to scroll the DataGrid (or perhaps whenever the mouse is over the Flex application [which is embedded in an HTML page])? I'm thinking perhaps there's a javascript solution, I'm not sure.


Solution

  • You might need to listen for scrolling event in your scrollable container (TextArea/DataGrid/whatever) and event.stopPropagation()

    It is also a good idea not to stop event propagation when you are at top/bottom of your container, in that case user probably wants to scroll the outer container.

    viz http://livedocs.adobe.com/flex/3/html/help.html?content=events_08.html