61
Views
21
Comments
Solved
[OutSystems Data Grid] How to edit action column?
Question
outsystems-data-grid
Reactive icon
Forge asset by OutSystems

Hi All,

I want to edit the action column. Currently, the grid's action column doesn't allow for editing. 

Is there any way to enable editing for the action column in UI? 

Thanks,

SK


2025-12-04 09-01-03
Kiet Phan
Champion
Solution

Hi @Sathish Kumar R 

You can use Text Column for editable purpose. and then add CSS to the column, to make it look like a hyperlink. Finally, use JS to make it can call an action when user click on it.

2025-12-04 09-01-03
Kiet Phan
Champion

Bro, Action Column won't allow you to edit. Outsystems don't generate an input widget for Action Column. 

If you need an edittable action column, let do some customization by Javascript on the Text Column. But the behavior seem to be weird if we can edit text in Action Column, because when we click the text, it will call the action.

UserImage.jpg
Sathish Kumar R

Hi @Kiet Phan 

Users will not edit existing values. they will only add new data when creating a new row. At that time, I need to add a value. 

2025-12-04 09-01-03
Kiet Phan
Champion

@Sathish Kumar R 

got it, when user add new data, you can also set the value to the action column by this JS:

  1. const grid = OutSystems.GridAPI.GridManager.GetGridById("MyGrid");
  2. var column = grid.getColumnByIndex(5);
  3. var colIndex = 1;
  4. grid.features.cellData.setCellData(colIndex,column,"new value");

the Result:

UserImage.jpg
Sathish Kumar R

Hi @Kiet Phan 

I tried, but I am unable to achieve this. Whenever I try to add a new row, the action column should be editable, but it remains uneditable. Could you please share a working OML? I can also share my OML for you to review. 

Thanks

SK

TestApplication.oml
chrome-capture-2024-10-5 (1).gif
2025-12-04 09-01-03
Kiet Phan
Champion

You made me confuse abit. As I said above, the Action Column it will not be edittable (like a input widget). You can just set it's data value.

By the way is this what you need


UserImage.jpg
Sathish Kumar R


Thanks for the clarification! Just to confirm, the Action column will be completely non-editable, even for new rows. I had initially thought it was only for existing values, so I appreciate you clearing that up.

Also, do you have any other ideas on how we might achieve this business goal?



Thanks,

SK

2025-12-04 09-01-03
Kiet Phan
Champion
Solution

Hi @Sathish Kumar R 

You can use Text Column for editable purpose. and then add CSS to the column, to make it look like a hyperlink. Finally, use JS to make it can call an action when user click on it.

UserImage.jpg
Sathish Kumar R

Thanks for the suggestion! Do you have the JavaScript code for calling an action when the user clicks on it? As of now, The Text column have "On cell value change" event handler and "On column reorder" event handler, so how do we trigger the action when the user clicks the action? 

2025-12-04 09-01-03
Kiet Phan
Champion

Hi @Sathish Kumar R,

Outsystems doesn't provide an offical click event handler for cell. So we need to do it on JS.

I attached the OML file, you can check the solution.

TestApplication (1).oml
UserImage.jpg
Sathish Kumar R

One more step forget—once the user clicks the column, how do we get the cell value in that click event? 

2025-12-04 09-01-03
Kiet Phan
Champion

Hi, You can get the value via row DataItem and pass it into the handler action.

I attached the OML, you can check it.

TestApplication (2).oml
UserImage.jpg
Sathish Kumar R

Thank you for the quick reply and solution! I appreciate your help. 

2025-12-04 09-01-03
Kiet Phan
Champion

You're welcome.

I think there is also a point you need to know, when user double click to edit the cell. We should not trigger the Action.

I already implement that. You can check the new attachment below.

Now when user double click to input cell value, the action will not be called.

TestApplication (3).oml
2025-12-04 09-01-03
Kiet Phan
Champion

okay, give more question if you have problems.

I'm happy to help.

UserImage.jpg
Sathish Kumar R

Thanks! @Kiet Phan
I think we should only trigger the action when the user clicks on an existing cell value, not on a new row entry. Since users can type data directly and they click new row cell value multiple time as well, we shouldn't call the action in that case. It shouldn’t be a double-click, just a single click on the existing cell. Am i right?

2025-12-04 09-01-03
Kiet Phan
Champion

yes, you can check cell value in the javascript to check if the cell empty or not, and decide not to call the Action when it's empty.

UserImage.jpg
Sathish Kumar R

Thank you so much for your wonderful help @Kiet Phan :-)

2024-09-17 12-24-07
Rammurthy Naidu Boddu
Champion

Hi @Sathish Kumar R 

1. Add the Data Grid to the Page

  • Drag the Data Grid widget onto the screen and bind it to a list of records (your data source).

2. Define the Action Column

  • In the Data Grid, you can add an "Action" column to define what happens when the user interacts with a row (e.g., click a button to edit, delete, or trigger custom behavior).

  • Go to the Columns tab of the Data Grid and add a new column.

  • In the "Type" property of the new column, choose "Custom" (this allows you to insert buttons, links, or any custom UI element).

3. Add a Button or Link for Edit/Delete Actions

  • Inside the "Custom" column template, add a button or link (depending on the action type).
  • For example, to edit or delete a row, you might use buttons like "Edit" or "Delete."
  • Each button should be bound to an action (or client-side event) for that row. You can pass the current record ID to the action to ensure you edit/delete the correct row.

4. Create the Actions

  • Edit Action: Create a screen action (EditAction) that will trigger when the Edit button is clicked. In this action, you can fetch the record data, open a modal for editing, or enable inline editing in the row.

Example of Edit Action Logic:

  • Fetch the record based on the ID passed in the button.
  • Show the fetched record data in a modal (for full edit) or enable inline edit mode in the grid.

outsystemsCopy code// Pseudocode for the EditActionGetRecordById(CurrentRow.Id)OpenModalWithRecordData(Record)

  • Delete Action: For delete functionality, create a DeleteAction that deletes the current record and refreshes the grid.

outsystemsCopy code// Pseudocode for DeleteActionDeleteRecord(CurrentRow.Id)RefreshDataGrid()

5. Enable Inline Editing (Optional)

  • If you want to allow users to edit the values directly in the row (inline editing), set the Column Type of the editable column to "Editable".
  • Add logic in the screen or server action to save changes when the user finishes editing (for example, when they click outside the cell or press Enter).

Steps:

  1. Set the column type to Editable.
2024-09-12 07-55-10
Sana Shaikh

Hello,

To enable and configure an Action Column for editing in an OutSystems Data Grid, you can follow these steps. The Action Column typically contains buttons like Edit, Delete, or Custom actions that can trigger specific logic when clicked.

Steps to Add and Configure an Edit Action Column in a Data Grid:

1. Add a Data Grid to Your Screen

  • First, ensure you have a Data Grid on your screen and bound to the required data source (entity or list).

2. Enable the Action Column

  • To create an action column with an Edit button, follow these steps:

a. Select the Data Grid on your screen. b. Go to the Columns property of the Data Grid widget in the Properties panel. c. Click the “+ Add Column” button and select Action Column.

3. Customize the Action Column

  • Once you add the action column:

a. Set the Header Title to something like "Actions". b. Under the Actions section, click Add Action. Choose the Edit action or create a custom action if you want.

The Edit button will now appear in the action column for each row of the grid.

4. Implement the Edit Logic

  • After adding the edit action, you need to implement the logic that will be triggered when the Edit button is clicked.

a. On Edit Button Click: - When you click on the action button, it can trigger a client action or server action. - For example, in the OnClick event of the button, you can open a Popup, Modal, or Form where the user can edit the selected row’s details.

b. Get the Row Data: - To access the specific row’s data (such as ID, name, or other fields), you can pass the relevant row data as input parameters to the action.

c. Save Changes: - After the user edits the data, you will need to implement the logic to update the record in your database and refresh the Data Grid to reflect the changes.

5. Example Logic for Edit Action

  • If you're using a Client Action to open an edit form:
    1. Pass the RowId of the selected row as input to the Client Action.
    2. Use the RowId to fetch the current data for that row.
    3. Show the data in a form (could be a popup).
    4. After editing, use an Update Action to save the changes to the database.

6. Handling Grid Refresh After Edit

  • After the edit is completed and the record is updated, ensure the Data Grid is refreshed. You can achieve this by:
    • Refreshing the data source used in the Data Grid.
    • Refreshing the entire Data Grid widget so that the updated data reflects immediately.

Example for Opening a Popup on Edit Button Click:

  • In the OnClick event of the Edit button, you can create a Client Action that opens a popup for the selected row:

    Popup_Editor.Show(RowData) // Show popup with the selected row's data

Once the popup is edited and saved, trigger the logic to update the data in the entity or list and refresh the Data Grid.

Hope this helps.

2024-03-23 18-16-49
Bryan Villalobos

Some of the answers in this post seems to be AI-generated. I have checked them with some AI detectors to confirm and it seems to be the case. (Correct me if I am wrong)

I am not against AI generated answers. But while seeking the answers using AI is a good move to help people from in the forum very quick, it requires one to check the content and make sure it provides the correct solution. 

The answers, although related to data grid, doesn’t answer what the OP is asking.

As members of the forum using AI-generated answers:

1. Please make sure to double check and confirm the generated answer. It may cause confusion and misdirections. Let’s try to understand the questions very well so we will be able to give proper answers.

2. Test what you are suggesting based on the answer that you are giving, especially if it is a complex one. You may give a sample oml that demonstrates the solution. Or some screenshots that explains your solution further visually.

3. Add some links, if applicable, that points to the documentation and further readings or another answer in another post.


Thanks

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