[OutSystems Data Grid] How do I programmatically select a row in DataGrid?
data-grid-reactive
Reactive icon
Forge component by Platform Maintenance
Application Type
Reactive

I have a DataGrid that has editable columns, what I want to do is after I edit a cell, I want to select its row (like image below).

 I can't find an action to do this in the DataGrid client actions. How do I achieve this? Thanks

2020-08-05 09-00-16
Gabriel Lundgren

Hey Kenneth,


Thanks for bringing this up. Unfortunately, as of now, there is no way to achieve this, since we've discovered a little bug that affects this behavior. 

We'll add this to our backlog. 


Greetings,

Gabriel Lundgren

mvp_badge
MVP

Hi Kenneth,

Probably the below-mentioned approach will help you with your use case.

  • To get the required grid behaviour, execute the below-mentioned JS in the Grid OnInitialize event handler action flow.


JS Snippet:

var gridObj = GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider;

gridObj.cellEditEnded.addHandler(function (s, e) {
var oldValue = e.data;
var newValue = s.getCellData(e.row, e.col);
  if (oldValue !== newValue) {
	gridObj._rows[e.row].isSelected = true;
  }
});

Demo screen: DG_HighlightRowDataChangeTask

Refer to the attached oml file.

I hope this helps you!


Kind regards,

Benjith Sam

RWA_Lab_DG_HighlightRowDataChangeTask.oml

I tried to install your oml however it does not seem to work. Also applied the js script on my own application but no luck as well.

Although as I see it works on your Demo screen.

Is it possible due to Data grid version? I current have the latest version installed (2.8.0).

Hello.

As Gabriel mentioned we'll add a new API to do this in a future release (under code ROU-3643)

Cheers,
GM

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