30
Views
4
Comments
Solved
[OutSystems Data Grid] how to disable datagrid action link by value?
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Regarding the ActionColumn (link) in the datagrid, I am using ExternalURL to set the link destination based on the URL in the following data:

Columns: Title, URL

A, https://a.com

B, https://b.com

None, empty


I want to disable the datagrid link when the Title is "None" after the datagrid data is displayed.

Is there a good way to achieve this?

Even when I use AddCellCssClass in the datagrid's OnInitialize, or try the disable link JS on the screen, it doesn't work well.

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

Hi R R,

You can use the following JS snippet in the OnInitialize event of the data grid:

  •    var grid = OutSystems.GridAPI.GridManager.GetGridById($parameters.GridId).provider;
  •    grid.formatItem.addHandler(function (s, e) {

  •       var rowObj = s.rows[e.row];
  •       var item = rowObj.dataItem;

  •       var title = (item.Entity1 && item.Entity1.Title != null) ? item.Entity1.Title : "";
  •       var url = (item.Entity1 && item.Entity1.URL != null) ? item.Entity1.URL : "";

  •       if (title === "None" || url === "") {
  •         e.cell.style.pointerEvents = "none";
  •       }
  • });

I highlighted the parameters that you need to change in your code (the column bindings).

I also attached a sample OML for reference.

DG_Action.oml
UserImage.jpg
R R

Thank you!
Wishing you a successful and prosperous New Year! 

2023-10-16 05-50-48
Shingo Lam

Hi R R,

There are some solutions:

  • Loop the data list then set the URL to empty when the Title is None, the link will not be rendered => If you still wanna show the link on UI, then this one is not applicable 
  • Css class to disable: OnInitialize the DOM is not completed rendered, you can try the OnReady instead
  •  JavaScript to add the disabled attribute to the URL whenever the Title is None

Hope this help

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

Hi R R,

You can use the following JS snippet in the OnInitialize event of the data grid:

  •    var grid = OutSystems.GridAPI.GridManager.GetGridById($parameters.GridId).provider;
  •    grid.formatItem.addHandler(function (s, e) {

  •       var rowObj = s.rows[e.row];
  •       var item = rowObj.dataItem;

  •       var title = (item.Entity1 && item.Entity1.Title != null) ? item.Entity1.Title : "";
  •       var url = (item.Entity1 && item.Entity1.URL != null) ? item.Entity1.URL : "";

  •       if (title === "None" || url === "") {
  •         e.cell.style.pointerEvents = "none";
  •       }
  • });

I highlighted the parameters that you need to change in your code (the column bindings).

I also attached a sample OML for reference.

DG_Action.oml
UserImage.jpg
R R

Thank you!
Wishing you a successful and prosperous New Year! 

2025-08-20 12-58-03
ADITI CHATURVEDI

Option 1 (Recommended Approach): Regulate the URL Value Directly 

Instead of attempting to hide the link visually, prevent navigation by omitting the URL when the Title is "None".  

Implementation Method:

Assign an expression to the ActionColumn’s ExternalURL:

If(Title = "None", "", URL)

Outcome:  

Entries with Title = "None" will not trigger navigation, rendering clicks ineffective. This requires no JavaScript and functions reliably.


Option 2: Conditional Display with a Custom Column

For comprehensive control over the user interface:  

Substitute the ActionColumn with a Text/Link widget placed within a Template Column and render the link conditionally:

If(Title <> "None", Link, Text)

Outcome:

The link will only display when valid, while non-clickable text will show when Title = "None". This method is fully supported and behaves predictably.


Option 3: Disable Interaction with CSS (Visual Only)  

If retaining the ActionColumn is essential:

    .disabled-link {

      pointer-events: none;

      color: #999;

      cursor: default;

    }

Apply this class conditionally once the data is loaded (for example, OnAfterFetch).

Utilize Option 1 if you want to disable navigation logically, or choose Option 2 for greater UI control. The OutSystems Data Grid is driven by data, making expressions and data the most dependable means to manage behavior rather than manipulating the DOM.

I hope this helps.

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