Staff
32
Views
5
Comments
Solved
[OutSystems Data Grid] datagrid OnCellChange not triggered with tabbing within same row
data-grid-reactive
Reactive icon
Forge component by Gonçalo Martins
Application Type
Reactive
Service Studio Version
11.54.24 (Build 62760)
Platform Version
11.23.1 (Build 40847)

Asking on behalf of customer: 

I have a data grid within my reactive web app. I use a client action to write changes to the data grid back to my on-prem SQL database when a cell in the grid changes. My client action is the handler for the OnCellValueChange event in one of my number columns. Below is the client action.


The client action above is correctly being triggered whenever I change a cell in my grid. The issue occurs when I click within the same row or hit 'tab' after changing the cell. The client action is triggered, but the 'GetChangedLines' widget in my action does not recognize a changed cell until I click off that row. Is there a way I can alter the 'GetChangedLines' to pick up a changed row whenever a cell is changed, regardless of the action taken afterward? Thanks in advance.


DG_flow.jpg
Solution

Hi, @Matt Geiger!

The Tab key behavior is a default behavior from the provider. You can check it here. 

However, we have a workaround for this use case. To fix that issue with the change not being committed when clicking in a cell in the same row,  you need to add this piece of code in the GridOnInitialize event:


var grid = OutSystems.GridAPI.GridManager.GetActiveGrid();grid.provider.cellEditEnded.addHandler(() => {
    grid.provider.itemsSource.commitEdit();
});


To make the GetChangedLines Action to work inside the OnCellValueChange event, you need to add a setTimeOut to the OnCellValueChange Client action calling the action. For example:


setTimeout(() => {
    $actions.GetChanges()
}, 0);


I am attaching the OML with this workaround implemented. 


Regards, 

Giuliana.

GLN_Sandbox_Reactive (1).oml
Solution

Hello @Matt Geiger 

After reaching Wijmo's FlexGrid support, they confirmed that the current design is that if we interrupt editing with the tab key, the value is not considered finalized, so for now we can't provide you a way to achieve that.
However, since this makes sense to us from a product standpoint, we've created an investigation task (ROU-4588 for future reference in the release notes) in order to try to implement that behaviour (a workaround) on top of Wijmo's FlexGrid, but we can't provide any ETA at this point.

Cheers,
GM

Hi @Matt Geiger,


This is a issue and we could reproduce on our environment. However, the issue occurs on the provider's end. We'll contact them and see if there's a workaround for it, but we can't promise anything right now.

In the meantime, you can see what changed in that cell by looking at the "OldValue" and "NewValue" parameters in the "OnCellValueChange" event. 



Best regards,

Bernardo Cardoso

Solution

Hello @Matt Geiger 

After reaching Wijmo's FlexGrid support, they confirmed that the current design is that if we interrupt editing with the tab key, the value is not considered finalized, so for now we can't provide you a way to achieve that.
However, since this makes sense to us from a product standpoint, we've created an investigation task (ROU-4588 for future reference in the release notes) in order to try to implement that behaviour (a workaround) on top of Wijmo's FlexGrid, but we can't provide any ETA at this point.

Cheers,
GM

@Gonçalo Martins thank you for the update!    We will continue to look for options and watch this thread as well.

Solution

Hi, @Matt Geiger!

The Tab key behavior is a default behavior from the provider. You can check it here. 

However, we have a workaround for this use case. To fix that issue with the change not being committed when clicking in a cell in the same row,  you need to add this piece of code in the GridOnInitialize event:


var grid = OutSystems.GridAPI.GridManager.GetActiveGrid();grid.provider.cellEditEnded.addHandler(() => {
    grid.provider.itemsSource.commitEdit();
});


To make the GetChangedLines Action to work inside the OnCellValueChange event, you need to add a setTimeOut to the OnCellValueChange Client action calling the action. For example:


setTimeout(() => {
    $actions.GetChanges()
}, 0);


I am attaching the OML with this workaround implemented. 


Regards, 

Giuliana.

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