How to automatic select 1st object from list view

0
Hello Everyone, I am using tree node and inside tree node using list view associated to tree node so from 1st object from tree node and associated 1st object from list view should be auto select when page will open so please suggest me solution.  
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