Access grid columns property

Good morning,

Using an Inline Datagrid, we are trying to have a dynamic filter that will be effective when the user opens the form, but that he will be able to modify inside the form.

The column that needs to be dynamic is named IsDeleted (boolean value), and when the value is True in the database, it should not be diplayed when the form is opened, but the user is still able to change the filter of this column to display all the values

For this, we set the FilterValue property of this column to 0, and, on the event LoadData, we created a filter that returns the value of the FilterValue property with "this.grid0.columns.last.filterValue".

This part is working fine and as intended. When the form is opened, the user only see False values, but when changing the filter of the column IsDeleted, he can see True values too

However, we have a second form, where we also want to check the column IsValidated. We know that we can access the first column with this.grid0.columns.first, and the last column with this.grid0.columns.last, but how can we access the properties any other columns from the grid?

Best Regards

Hi @Yroquain,

That's some advanced DataGrid usage! The columns property of the DataGrid is of QueryList type. You can use its toArray method and then access any item you want. For example: this.grid0.columns.toArray()[1]

2 Likes

Perfect, this is working exactly as we wanted, thank you!