Setting first line as selected in Datagrid2

0
I need that the first row is default selected in datagrid2. I didn't see anywhere. AI offers very complicated solutions. Is there simple way to do this? I wonder why Mendix didn't take this cute property of datagrid1.
asked
3 answers
1

I have searched this issue. Fortunately, this feature is included in the new versions.


answered
0

Hi Necdet,


There's no need to use two DataGrid2 widgets for this.


One approach is to add a Boolean attribute (for example, IsSelected) to your entity, with a default value of false.


In your data source microflow:

  • Retrieve the list of objects.
  • Use a List Operation → Head to get the first object.
  • Set its IsSelected attribute to true.
  • Return the list.


Then, in your page logic, use this Boolean attribute to determine which row should be treated as the default selection. When the user changes the selection, simply update the Boolean accordingly.


This keeps the page much simpler than maintaining two separate DataGrid2 widgets.


Kindly mark this as the accepted answer if it helps.

answered
0

Have a look at https://marketplace.mendix.com/link/component/253866

Convent Commons does have the answer on your question: DataGrid2: Auto-Select (First) Row

answered