Data Grid 2 Widget and Drop Down for Page Size

0
I have a Data Grid widget and based on the requirement, 5 records are displayed at a time which I set n the properties. We have another requirement to allow the end user to have a dropdown where they can select 5, 10, or 20 for the number of records to display.    So far searching the community, I am not seeing a solution for this. This seems like a pretty common thing to do, but not intuitive with the Mendix Platform. If I were not using a low code tool, this would be easily doable in programming languages like c# and asp.net or MVC   Anyone solve this problem yet? We are trying to use Mendix out of the box and not use community modules by other users so we would like to be able to solve this with what Mendix has to offer out of the box.
asked
1 answers
0

ANSWER

 

After working on it longer, I have determined "A" solution, not saying its the only solution, but it's working.

 

For my paging sizes, the requirements are 5, 10, or 20. The default is 5. So what I did is I created 3 data grids, I changed the page size via the properties on each data grid, one defaulted to 5, the other to 10, and the last one to 20.

 

I created a enumeration that has all three page sizes in it:

 

image.png

 

On the page that has the 3 data grids, I added a Variable called PageSize that is of type [THE ENUM I CREATED] and the default value set to 5:

 

image.png

 

Then for each data grid, under the visibility property, I added an expression that checks the variables value and sets true or false based on that variables value which would be 5, 10, or 20. Based on that, we will display the corresponding Data Grid showing that page size and hide the others.

 

The example below is the expression for the data grid that has a page size of 5

image.png

 

Hope this is able to help someone else wanting to do this very common thing. There probably is a better way to do it since this causes a maintainability issue with updating grids multiple time, but this is the way I solved the problem and it works. 

 

answered