212
Views
4
Comments
Solved
[OutSystems Data Grid] Get the Number of Filtered Records
outsystems-data-grid
Reactive icon
Forge asset by OutSystems

Hi, as per the title, how can I get the number of filtered records after the grid is filtered by columns? Currently, I am assigning the variable with the number of records fetched by the aggregate, which is '499' on the top. 

However, after filtering the grid by columns, the number of records will change too. For example in the snapshot, the number of filtered records is 15 and it can be seen at the pagination row. So what I hope to achieve is, on every filter, the number of entities found on the top can reflect the latest data grid records.  

I have tried to recreate this RecordNumber web block from the data grid module, but it does not show any value at all. The only difference between my block and the original block is the GridWidgetId passed, where I passed the grid widget id on the page, and the original one passed the uniqueId which I don't understand where to get this value.

I would appreciate it if you have any other solutions. Thank you.

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hi @Max Chia 

Glad to know it works and unblocked your use case! Please mark it as a solution to close the thread.

There's no specific documentation of the API since this is just a non-official way that was created to allow developers with more experience to achieve use cases that are not offered out of the box since the component focus is to offer a low code experience, not the need of writing javascript but at the same time, we will never offer 100% of the use cases so this was a possible path. 
However, you can refer to the GitHub repo and since this is a way to extend the component by allowing extending the underlying provider Wijmo, you can rely on that to see the possible options. Personally, what I always do is, after checking Wijmo's documentation I start exploring the API in the browser's dev tools.

Cheers,
GM

2022-11-12 11-28-30
Gonçalo Martins
Staff

Hi @Max Chia 

To achieve that you can use the following steps:

  • use the block OnFiltersChange (pass the Grid block identifier)

  • On its handler call the following script to get the total number of rows:

Hope it helps.

Cheers,
GM

UserImage.jpg
Max Chia

Hi GM,

Thank you for the quick answer, your solution works perfectly. May I know where can we access the OutSystems GridAPI JavaScript documentation? I have tried searching in Wijmo's documentation, but I did not find any, or maybe I just missed it.

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hi @Max Chia 

Glad to know it works and unblocked your use case! Please mark it as a solution to close the thread.

There's no specific documentation of the API since this is just a non-official way that was created to allow developers with more experience to achieve use cases that are not offered out of the box since the component focus is to offer a low code experience, not the need of writing javascript but at the same time, we will never offer 100% of the use cases so this was a possible path. 
However, you can refer to the GitHub repo and since this is a way to extend the component by allowing extending the underlying provider Wijmo, you can rely on that to see the possible options. Personally, what I always do is, after checking Wijmo's documentation I start exploring the API in the browser's dev tools.

Cheers,
GM

UserImage.jpg
Max Chia

Hi GM, 

Thanks for the explanation, helped a lot!

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