Custom microflow to sorting on a datagrid2 column headers

Is there a way to right our own logic on datagrid2 column headers (Like an onclick event)?   Currently I had implemented a custom pagination with a datagrid2 which is  inside a dataview. Now my limit on each page is 50 records. If I am applying a default datagrid2 sort functionality then its sorting only on those 50 records but I want to sort the entire table and show the first 50 records based on asc or desc. So in that case I want to right my own logic on each and every column headers in datagrid2. Is that possible or Is there any other way to do this?   Kindly give me your suggestions.    Thanks in advance.
2 answers

since you are getting all this using ur custom logic I think u can now even go ahead and remove the data drid and use the list VIew .That way u can use a simple layout grid to show headers and on click of headers u can trigger the change and achieve the desired result.


on thing worth trying is using data grid for this and let mendix generate all the microflows and nanoflows for sorting and pagination and then remove datadrid and use data grid 2 .I haven't tried it my self but I think this should work too if you are going to use Datagrid 2 only.





Hi Senthil,

For this requirement, you can create an NPE, and then use it as a parent dataview for the datagrid 2,

Now, for sorting/Filtering purpose, you can use retrieve and Xpath, and sorts based on your requirement.


Other way to achieve this is to use OQL instead of XPath,

and write queries, that will help you to achieve various requirement, based on your need.

Let me know, if you face any issues,

Hope it helps!