25
Views
5
Comments
[OutSystems Data Grid] [Outsystems Data Grid] Don't Show Empty Button in Action column
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

In my outsystem data grid, I have an action col with a button.  It's a conditional button however, and I need it to now show up of the text inside the buttom is "".  If there is no value in the col I need to not show it or add a class to make it not visible somehow.  I'm not sure the syntax to add the class based on the text inside the child button in the GridOnInitialize action.  Any help would be appreciated.

2021-04-09 11-42-43
assif_tiger
 
MVP

HI @David McCulloch
you can use below 2 approach:
1- use the visible property of button to hide it based on you condition 
or
2- use extended property of button
    define the property as : class
    value as : If(GetData.List.Current.ButtonText = "", "btn-hidden-class", "")

where the btn-hidden-class  will be using display: none
good luck

UserImage.jpg
David McCulloch

Yes, editing a button is simple, but those aren't options in buttons generated via Data Grid.  This is for buttons in data grid.  usually classes and such are edited via the Javascript widget in the OnGridInitialize action, but I can't find the syntax to edit, or interact specifically with buttons that are generated.

2025-07-22 10-30-27
Mandar Deshpande

Inside OnGridInitialize action, you can try using below JS code:

// Example for column named "Action"

gridOptions.columnDefs.forEach(function(col) {

    if (col.field === "Action") {

        col.cellRenderer = function(params) {

            if (!params.value || params.value === "") {

                return ""; // no button

            }

            return "" + params.value + "";

        };

    }

});

2025-12-29 06-17-15
Deepak Raj M

@David McCulloch can you share your oml file

2022-11-12 11-28-30
Gonçalo Martins
Staff

Hello @David McCulloch 

To make this more collaborative and to make sure the community is looking into the same use case that you're reporting, please share a sample oml where that can be reproduced and please indicate the steps to reproduce the scenario you mentioned (include a GIF/video if it's easier).

Cheers,
GM

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