How to make auto select 1st object of list view

0
Hello Everyone, I'm using list view so while user landing on page I have to make 1st object of list view should be auto selected so how can I achieve this ? Please help.
asked
1 answers
0

You can achieve this by using a helper object together with a page-load microflow. Create a non-persistent helper entity (for example PageContext) and add an association such as SelectedObject pointing to the entity used in the List View. On page load, execute a microflow that retrieves the same data source as the List View, takes the first object (for example by setting a limit of 1 or using Head), and assigns it to PageContext.SelectedObject. This makes the first item behave as if it is selected when the user lands on the page.

 

If you want the first item to visually appear selected, you can use conditional formatting or a dynamic CSS class on the List View item. Compare the current List View object with PageContext.SelectedObject, and when they match, apply a custom “selected” class. A common and effective approach is to copy the CSS styles that Mendix applies when a row is selected by default, create your own CSS class with those rules, and then dynamically apply that class to the matching item so it looks exactly like a normally selected row.

answered