45
Views
5
Comments
Solved
[OutSystems Data Grid] How to get filtered data from a datagrid?
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Service Studio Version
11.54.69 (Build 63461)

As shown in the first picture, this is the initial data. As shown in the second picture, this is the  filtered data. How can I get the JSON of the filtered data? 

Thank you for your assistance, best wishes. 

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

Hi @Cesar Ge ,

You can find your answer in this post.

I tried the solution and it worked perfectly for me to get the filtered data. 

You just need a javascript node inside the action you need to and then insert the following javascript:

var grid = OutSystems.GridAPI.GridManager.GetGridById($parameters.WidgetId)
var data = grid.dataSource.toOSFormat(grid.provider.itemsSource._view)
$parameters.GridData = data;

I hope this helps.


Regards,

Bryan

UserImage.jpg
Cesar Ge

Hi @Bryan Villalobos ,

Does the filter operation trigger the OnInitialize event of the DataGrid? 

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

Hi @Cesar Ge ,

No, OnInitialize event is not triggered during filter operation.

However, you can use the Grid_Events/OnFiltersChanged to listen to OnFiltersChanged event.


Regards,

Bryan

UserImage.jpg
Cesar Ge
UserImage.jpg
Giovanni Piccirilli

Hi @Bryan Villalobos,
Does this method works also for filtered rows on other pages than the one is visualized (it seems not)?
If not does datagrid provide any solution?

Thanks

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