[Data Grid] Datagrid - auto row height

Forge Component
Published on 3 Aug (3 days ago) by OutSystems R&D
38 votes
Published on 3 Aug (3 days ago) by OutSystems R&D

Is there any option to set the row height based on the cell contents (auto row height) rather than by setting a fixed row height?

Hello Linto Antony,

Thanks for bringing this subject to the discussion.
Right now we don't have a great solution that can actually solve your question.

The DataGrid team is analyzing this topic and we'll get back to you with:

  • What to do to workaround this

We'll update you as soon as we have the answers for you.

Thank you,

Tiago Pereira

Hello Linto Antony,

As I mentioned in my previous message, here follows a workaround type of solution.
You will need to include a Web Block containing the method that you want for setting the rows with a dynamic height resulting in something like in the image below: (This block is included in the sample attached)

Inside the Web Block you can see that we have a Javascript block containing the method responsible for formatting the cells inside the grid. We need to define which are the columns that we want to have that behavior. So we need to edit the AdvancedFormat of those columns. Feel free to change the columns according to your needs. 


"wordWrap: true,
 multiLine: true"

Right now we need to override the method formatItems because we are explicitly defining the height of the rows inside. So in this Web Block I commented that line for you.

Remember that by using this extended feature, the method related to the formattings of the grid will get overwritten. Specifically, the method formatItem.

Hope this sample is useful if you need to extend DataGrid to have the rows with a dynamic height according to the space that the text needs so that it can be fully presented.