Setting filter using component inputs don't change the table data

Heyaa, I'm using a checkbox to set filters to my table. The filters are loaded on the table but it won't filter the data on the table. I checked the Add filters. button of the table and saw both my desired filters--table still didn't reflect the filtered data (more like the data remain unchanged). Here's the filter I used:

[{columnName: "stampBalance", operator: "greater than", filterValue: 0 },
{columnName: "unclaimedRewards", operator: "greater than", filterValue: 0}]
StackType: or

I tried this on Checkbox (Event: True/Change), Button (Event: Click), and Text Input (Event: Change) but the same scenario occurs: data on the table remains unchanged despite the filters being added. However, if I changed the value directly on the set filter (after I've set them using one of those component events) in Add filters. of the table (e.g. 0 -> 00), the data refreshes to reflect the filters.

Is there something I'm missing in setting filters or this is a bug?


Hi @jocen! Would you mind sharing a screenshot of how exactly you're setting these filters on your table? Are you using .setFilters in a JS query or in a script of an event handler?

Hi @victoria, thanks for the reply. This is the doc I've been searching. Can this be linked in the adding filter doc and/or the component property docus. It's probably just me but having all the examples use 'contains' limits how I view the proper syntax used for the operator.

On my implementation for setting the filter, please see below:
Screen Shot 2021-08-23 at 10.21.54 am
I know I'm doing something wrong here since the array preview is an empty array of object when the radioGroup1.value is already 2. I'm using a script on an event handler. Thanks!

Hey jocen, stepping in for Victoria here. In your filters field, the left hand operators of you ternary statement will always return true. You are 'setting' the value to 1, instead of checking for equality. Here's a small example.

My text component will always have a value of 'test' with this statement. You need to switch radioGroup1.value = 1 to radioGroup1.value == 1 (and the same for radioGroup.value = 2).

Hope this helps!

I see, I've been using SQL syntax on JS area. LOL :man_facepalming:
Thanks for this! I've been answering some questions in the community with such syntax so will edit those as well.

No problem! Glad to help. Thanks for answering some community questions as well. Love to see everyone helping each other out!

Question for those on this thread:

I am attempting to use a multiselectListbox component to create an easy way to filter table data (rather than using the native filtering capabilities on the table). To achieve the filtering I'm attempting to call setFilters through an Interaction on the multiselectListbox. In general my flow looks like this

  • User choose a value in the multiselectListbox
  • This triggers an interaction using setFilters through an onchange event on the multiselectListbox
  • The filter values are read from a javascript transformer (call it transformer1)

My issue

It seems that reading the value from the javascript transformed is delay or out of order transformer1.value. Every change in the multiselectListbox is one step behind. Example - if I select "Option A" my table shows "Option A" and "Option B". If I select "Option B", my table now shows "Option A".

My question here - is there a way to trigger an update to the javascript transformer directly? It seems to me that my table is being updated based on an old value of the javascript transformer, not the new one.

Additionaly - a way to solve this would be to allow the "Filters" input to accept more robust javascript (not just a one liner).

Update here - I was able to get this working by doing the javascript inline for the "Filters" in the multiselectListbox. Keeping the javascript transformer was not necessary. My resulting JS code

{{>{ return {columnName: "Team", "operator": "equals", filterValue: x} })}}