Iterate data grid

Hi, Happy Friday!

I want to iterate a data grid in the front-end. Is there an example to show how to iterate columns and data?

For example, to show the name of each column. Using "datagrid.Columns" or "datagrid.ColumnsCollection"?

Another question is that why the data grid column name showed on the browser is always capitalized (every alphabet)? Is there some way to change it?

Thank you.

I'd like to add that is there somewhere that I can find the description of each property or function? This document is not up-to-date.

You can iterate the columns via the ColumnsCollection property. To iterate the data you can use the View property - it contains the current "view" of the data - with applied paging, sorting and filtering.

This is how we have styled it. Can be changed with CSS:

.rz-column-title {
   text-transform: none !important;

We will document the missing properties (ColumnsCollection and View). Meanwhile you can always check the source code.

Hi @korchev
Thank you for replying.

I am looking forward to the update of the document.

I have an additional question. The view property contains entities, but we cannot know the sequence of the data grid column. Thus, do we need to use object reflection to iterate the data grid? I attached my code. Is it the best practice? Thank you.

I don't know what you are trying to achieve so I can't comment on that.

Hi @korchev
I want to iterate a data grid and print the content of each cell, from the first row, the first column, to the next column, and then the next row. The problem is that only ColumnsCollection records the sequence of columns, so the only way I can think of right now is to use reflection. I hope there will be a better way to do that.

For example, print 1,2,3,4,5,6,7,8,9 for the following data grid.

Using the reflection is the only solution for your requirement.