92
Views
10
Comments
Solved
Filter data in table.
Question
Application Type
Reactive

Hi,

I am working on displaying a data table using a table component. I have retrieved data from the database using a data action. I would like to add filtering to each column with a filter icon in the header row. When the user clicks the filter icon, it should show a popup with some input fields. How can I implement this?



2019-01-31 08-54-57
André Costa
Champion
Solution

Yes, ofc:

You can accomplish that with this implementation:


Make sure you don't have any sort attribute defined in the header. Then, add a container with the class "sortable-icon" or use the "sort" icon itself.

2019-01-31 08-54-57
André Costa
Champion

Hi @Lukasz Kapron 

One possible solution is the following:

  1. Add a new icon in each column header. You’ll need a local variable for each column to control the filter's visibility (or a single variable if you want to show/hide all filters at once)
  2. Set up an OnClick event for each icon to toggle the visibility of the respective filter (or a button/link to show them all at once)
  3. Use an If condition below the label in each column header to display the filter based on the visibility variable for that column 


Does this solution solves your problem?


AC

UserImage.jpg
Łukasz Kaproń

Thank you for your reply!

It was helpful, but I can't undestand something. When I try to add a container, HTML tag, or icon component, it appears before the sorting tag. Is it possible to change this?

Here is an example:

2019-01-31 08-54-57
André Costa
Champion
Solution

Yes, ofc:

You can accomplish that with this implementation:


Make sure you don't have any sort attribute defined in the header. Then, add a container with the class "sortable-icon" or use the "sort" icon itself.

UserImage.jpg
Łukasz Kaproń

It looks like a good solution, but what if I want to use sort attribute?

2019-01-31 08-54-57
André Costa
Champion

You can continue to use the onclick action, just pass the attribute directly in the input

UserImage.jpg
Łukasz Kaproń

I found this component, but it seems quite challenging to implement server-side filtering or searching. I will have a lot of data. Do you have any tips on how to do it? 

2019-01-31 08-54-57
André Costa
Champion

@Vipin Yadav 

If you've understood the issue at hand, you’ll see that DataGrid is far from the best solution here—it’s like using a cannon to kill a fly. This issue can be solved with a simple CSS class, and there's no need to manage the complexity of a DataGrid.


2024-12-02 13-16-47
Vipin Yadav

@Lukasz Kapron you can use  @André Costa  solution by adding a filter icon and opening a popup when you click on it. 

Thanks,

Vipin Yadav


2024-12-03 08-50-23
Rounak Rawat

Hii @Lukasz Kapron 

I've attached the .oml file for reference. 

Thanks,

Rounak Rawat


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