32
Views
9
Comments
Solved
[OutSystems Data Grid] Adding tags to Dropdown Column in Datagrid
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Need a solution to add colored tags to the Dropdown Columns in Datagrid like below, any approach would help, whether it's through CSS, built-in options:

2026-01-28 16-57-48
Mihai Melencu
Champion
Solution

Hello @Karthik Santosh ,

Outsystems Datagrid is based on the Wijmo Flexgrid.  You can achieve the customization of your cells by using the Cell Templates . This allows you define custom styling.

You can use the following javascript in the OnInitialize event of the datagrid:

OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.columns.forEach(function(col) {    

if (col.header === 'TestHeader') {       

 col.cellTemplate = '<span style="background:blue; color: white; padding: 10px; border-radius:32px;">${text}</span>'  

} });


This is the result:

Make sure to change 'TestHeader' with the actual name of your header column and add the input parameter for the GridWidgetId. You can also use classes if you want.



UserImage.jpg
Karthik Santosh

Thank you, Mihai! Works perfectly fine!

2022-02-01 04-03-06
Ranjeet Singh

Hi @Mihai Melencu how to change color according to the text value.
like for active it should be Green otherwise red.

2026-02-16 05-51-10
Sahana K

Hi,
You can try this Javascript 

OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.columns.forEach(function(col) {    

    if (col.header === 'TestHeader') {       

        col.cellTemplate = `

            

                background: ${

                    "${text}" === 'Active' ? 'green' : 

                    "${text}" === 'Inactive' ? 'red' : 

                    'orange'}; 

                color: white; 

                padding: 10px; 

                border-radius: 32px;">

                ${"${text}"}

            `;

    }

});

Thanks,
sahana

2022-02-01 04-03-06
Ranjeet Singh


OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.columns.forEach(function(col) {    

    if (col.header === 'Status') {       

        col.cellTemplate = function(cellData) {

            let color = "yellow"; // Default to yellow for unknown status


            if (cellData.text === "Active") {

                color = "green";

            } else if (cellData.text === "Inactive") {

                color = "red";

            }

            

            return `${cellData.text}`;

        };

    }

});


its working as expected
if you want OS classes : 

OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.columns.forEach(function(col) {    

    if (col.header === 'Status') {       

        col.cellTemplate = function(cellData) {

            let cssClass = "tag tag-small border-radius-rounded OSInline background-primary"; // Default class

            

            if (cellData.text === "Active") {

                cssClass = "tag tag-small border-radius-rounded OSInline background-green";

            } else if (cellData.text === "Inactive") {

                cssClass = "tag tag-small border-radius-rounded OSInline background-red";

            }

            

            return `${cellData.text}`;

        };

    }

});


UserImage.jpg
Aliff Firdaus Suhaimi

Hi Ranjeet,

I tried applying your code but why I got this error? Am I missing something. Sorry, I'm not a developer. Maybe I miss something here.

Screenshot 2025-04-10 155846.png
UserImage.jpg
Karthik Santosh

Hi Sahana,

I am aware of adding tags in action columns but is there a way to add one in the dropdown column?


Thanks,

Karthik

2026-01-28 16-57-48
Mihai Melencu
Champion
Solution

Hello @Karthik Santosh ,

Outsystems Datagrid is based on the Wijmo Flexgrid.  You can achieve the customization of your cells by using the Cell Templates . This allows you define custom styling.

You can use the following javascript in the OnInitialize event of the datagrid:

OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.columns.forEach(function(col) {    

if (col.header === 'TestHeader') {       

 col.cellTemplate = '<span style="background:blue; color: white; padding: 10px; border-radius:32px;">${text}</span>'  

} });


This is the result:

Make sure to change 'TestHeader' with the actual name of your header column and add the input parameter for the GridWidgetId. You can also use classes if you want.



UserImage.jpg
Karthik Santosh

Thank you, Mihai! Works perfectly fine!

2022-02-01 04-03-06
Ranjeet Singh

Hi @Mihai Melencu how to change color according to the text value.
like for active it should be Green otherwise red.

2026-02-16 05-51-10
Sahana K

Hi,
You can try this Javascript 

OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.columns.forEach(function(col) {    

    if (col.header === 'TestHeader') {       

        col.cellTemplate = `

            

                background: ${

                    "${text}" === 'Active' ? 'green' : 

                    "${text}" === 'Inactive' ? 'red' : 

                    'orange'}; 

                color: white; 

                padding: 10px; 

                border-radius: 32px;">

                ${"${text}"}

            `;

    }

});

Thanks,
sahana

2022-02-01 04-03-06
Ranjeet Singh


OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.columns.forEach(function(col) {    

    if (col.header === 'Status') {       

        col.cellTemplate = function(cellData) {

            let color = "yellow"; // Default to yellow for unknown status


            if (cellData.text === "Active") {

                color = "green";

            } else if (cellData.text === "Inactive") {

                color = "red";

            }

            

            return `${cellData.text}`;

        };

    }

});


its working as expected
if you want OS classes : 

OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.columns.forEach(function(col) {    

    if (col.header === 'Status') {       

        col.cellTemplate = function(cellData) {

            let cssClass = "tag tag-small border-radius-rounded OSInline background-primary"; // Default class

            

            if (cellData.text === "Active") {

                cssClass = "tag tag-small border-radius-rounded OSInline background-green";

            } else if (cellData.text === "Inactive") {

                cssClass = "tag tag-small border-radius-rounded OSInline background-red";

            }

            

            return `${cellData.text}`;

        };

    }

});


UserImage.jpg
Aliff Firdaus Suhaimi

Hi Ranjeet,

I tried applying your code but why I got this error? Am I missing something. Sorry, I'm not a developer. Maybe I miss something here.

Screenshot 2025-04-10 155846.png
2022-12-30 07-28-09
Navneet Garg

Agreed with @Mihai Melencu you can use GridAPI to inject html you need check GridAPI javascript and you can also mix it with jquery for easy manipulation of html.

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