Create an attribute of Integer for serial number.
In datagrid 2 datasource, select microflow and create a variable as Count = 0 then in loop give serial number as Count + 1. likewise you can show the serial number for every row.
If you want a number to be linked to a certain object (for example: Cosmetic is always 1, Test Function always 2), you should add an autonumber attribute to your entity you display called serialnumber. Then you can display this attribute as a column in your data grid.
If you would want incremental numbering based on the data grid itself, the following forum post might help: https://forum.mendix.com/link/space/app-development/questions/91943