Hi,
I had a requirement to display row numbers when showing data in the AG data grid and I could not find a simple way to achieve it. In our old web-client solution I simply used a table view form and one of the fields displayed %%currentRecordIndex%% but with the new data grid in NG client I couldn’t see how to use that without adding a calculation to the table that returned the foundset index and didn’t want to do that for all my tables. Having researched it a bit on the web I came up with the following solution:
- Add a column to the grid (I always make this the first column)
- In the column properties click the columnDef and add three properties named lockPosition, suppressNavigable, and valueGetter
- Expand the columnDef node and set the property values to true, true and ‘node.rowIndex + 1’ respectively (Servoy will add the quotation marks for you)
- Change the showAs property to html
- Change the width of the column to suit the number of rows you expect in the table. 50px is enough to show a 3 digit number if the font size is 12px but experiment to suit your current styling
[attachment=0]screenshot.jpg[/attachment]
Resulting output:
[attachment=1]row_numbers.jpg[/attachment]
I hope this is not a sledgehammer to crack a nut and if there is some simple way to achieve it then please feel free to update this thread.