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.
HI @David McCullochyou can use below 2 approach:1- use the visible property of button to hide it based on you condition or2- 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: nonegood luck
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.
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 + "";
};
});
@David McCulloch can you share your oml file
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