In current Mendix versions, it is not possible to dynamically set the number of rows in a data grid.
Maybe this widget can be usefull to see how to build something for this yourself: https://appstore.home.mendix.com/link/app/877/Flock-of-Birds/Data-Grid-Extension-(Flex-Headers)
Otherwize a unelegent workaround could be to use conditional visibility and then show the datagrid with the 10, 20 or 50 rows based on a enumeration.
You can make from the datasource in the datagrid a microflow. In this microflow you can make a custom retrieved with a limit. You can make the user to determine the limit by adding a entity with an attribute called limit and associate this the the user. In the datasource microflow you should retrieve the user specific limit.
However, by doing this, you will loose the search function's on the datagrid.