How to Show Serial Number On Data Grid

I want to Serial Number on Data Grid. I have 1000 rows in a data grid , on data data grid i want to show one column name S.No it should be start from 1 to count of the row  so i want to 1 to 1000 row in column       col1              col2              col3 | __|___Name___|__City_________|  row |_____1 ___|___Raj ______|___Hyd _______| |_____2____|___Sonu ___|____mumbai__| |_____3____|___Mona___|____Bgl _______| if delete record 2 where name is Sonu after delete this record it should look like this     col1              col2              col3 | __|___Name___|__City_________|  row |_____1 ___|___Raj ______|___Hyd _______| |_____2____|___Mona___|____Bgl _______|  
1 answers

If you could explain your use case then we could think of a better solution.

I dont think there is an out of the box feature for the same, but you could do the following:

- Add an attribute ‘SrNumber’ to the data grid entity

- Update this attribute every time you create/delete an object for that data grid entity (Upon delete, this would mean updating all the objects of that entity, which is not very optimal)

- Add this attribute as the first column in data grid

- Sort your data grid using ‘SrNumber’ attribute