110
Views
2
Comments
[OutSystems Data Grid] [OutSystems Data Grid] Select rows programmatically
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

Hey Everyone!

I have a business request to store selected rows (via checkbox) in the database. This also implies that when we load the page, the previously selected rows need to remain selected

I tried to select the rows with the new API (SetRowAsSelected) but it says that it doesn't work if the RowHeader property is set to "RowHeader.RowCheckbox" 

How do I do this?

2019-07-25 15-05-16
Henrique Silva

Hello André!

If you follow this documentation by outsystems(How to save changes to the OutSystems Data Grid - OutSystems How to Guide), you will see that you can use the "GetChangedLines" and then Deserialize the results to get which lines changed on the datagrid.

If:

1. You send a structure to the datagrid with an IsSelected attribute, such as:

  • IsSelected(Boolean)
  • Attribute 1
  • Attribute 1

2. Map this IsSelected to a Checkbox column(Which you can find out how to do here)

3. Set this column as editable

You will be able to use the get changed lines to build your list of records that were selected/unselected.

As you said your selection needs to be persistent, than you will need to save this IsSelected attribute on the database, which you can also find how to do on that documentation.

Regards!

UserImage.jpg
André Silva

That doesn't really solve my issue. I need to use the default checkbox that comes with the Datagrid because I need the "Select All" checkbox in the header:

So if I use a Checkbox Column I won't have that option


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