[OutSystems Data Grid] How to break line on a cell?
data-grid-reactive
Reactive icon
Forge component by Platform Maintenance
Application Type
Reactive

Hello, I'm struggling with what seems a simple problem.


I call an API, and then assign its values to a specific structure that will populate the grid and generate the columns with the structure attributes. So far so good.

The problem is, during the Assigns that I do to a certain column, I need to combine 2 different fields (CountryName and ISOCode). I need to display the ISO code below the country name.

CountryName + "\n" + ISOCode doesn't work;
CountryName + "<br>" + ISOCode doesn't work;
CountryName + NewLine() + ISOCode doesn't work.


Here's how I want it displayed:

Here's the flow of the data action that gets the data ready:



Already accomplished it with some Javascript, but it resets whenever I do an interaction with the grid.

Any ideas?

mvp_badge
MVP
Solution

Hi Diogo,

I have a solution to suggest for your use case.

Steps to follow:

1) In the Data action flow, while preparing the data concate NewLine() in-built function (as highlighted below), to get the string in next line.

2) In the Grid OnInitalize handler flow execute the below JS

JS Snippet:

var gridObj = GridAPI.GridManager.GetGridById($parameters.GridWidgetId);

setTimeout(function () {
    gridObj._columns.forEach(function (col) {
        col._provider.multiLine = true;
    });
    GridAPI.GridManager.GetActiveGrid().provider.autoSizeRows();    
}, 50);

See this demo: DG_Col_MultiLine_Task

Refer to the attached oml.


I hope this helps you!


Kind regards,

Benjith Sam

NeoLab_DG_Col_MultiLine_Task.oml

Hi Benjith,

It worked, thanks for the help!


Diogo

mvp_badge
MVP

You're welcome, Diogo,

Glad to help you :)


Kind regards,

Benjith Sam

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.