Filter the Repeater with Multiple State Dynamic Panel

Hello Axurers,

I have

  1. an inner dynamic panel with multiple states (English and Mandarin) in a repeater in an outer dynamic panel
  2. a text field that adds a filter to the repeater OnTextChange
  3. a repeater with English and Mandarin fields
  4. a button that changes the state of the dynamic panel, i.e. all the items will change

What I want to do

  1. OnTextChange, filter the English field if the state of the dynamic panel is in English
  2. OnTextChange, filter the Mandarin field if the state of the dynamic panel is in Mandarin
  3. with the filter on, change states and maintain the filter

I can already do 1 and 3, however, having both 1 and 2 is a problem.

Problem
When I add an extra condition: “State of Panel is equal to English”, then the filter doesn’t work.
Here is the culprit in the red rectangle:

Without the extra condition the filter works, however, I would be unable to choose whether to filter the English field or the Mandarin field.

Other Issues
As mentioned before, without the extra condition, the filter works, however, any text changes would change the state of the dynamic panel back to the default state (I tried switching the order of the states and it does indeed change to the first state). Would it be possible to update the filter without changing the state back to the default?

Showing all items containing “o” in the English field:

Click on Change All to change the state to “Mandarin” while keeping the filter on:

Now any changes to the text field will automatically set the state of the dynamic panel to English.

Here’s the sample
https://ih4mt9.axshare.com/#g=1&p=home
Filter Repeater With Multiple State DP.rp (70.3 KB)

Wow, that took much longer to explain than I expected. I hope it makes sense. Thank you for reading all the way to the end.

I’ve just discovered two more things:

  1. Instead of using the extra condition as State of Panel == English, I used a dummy label that contains the state of the panel and used Text On Widget dummy == English. This works for some reason.

  2. The automatic change of panel that is triggered by the OnTextChanged event doesn’t trigger the OnPanelStateChange event.

I’ve also found a solution for the desired behaviour.

  1. Use a dummy widget (a global variable might work too) to store the state of the inner dynamic panel and use the conditional statement on that, instead of directly on the state of the dynamic panel
  2. The automatic change of the dynamic panel in the OnTextChange event can be countered with a Wait and a deliberate Set dynamic panel to Mandarin

Does anyone have a more elegant solution to this? The Wait makes the transition jerky.

https://42hao1.axshare.com/#g=1
Filter Repeater With Multiple State DP (Solution).rp (73.3 KB)

Hi Mactuarchitect,

Just wanted to chime in here and say that this might be happening because of the order these interactions are taking place. Adding a filter will cause the repeater to reload all of its items (refreshing any panel state changes), so it’s possible that having all of these actions occur at the exact same time would execute the “Set Panel State” action before the repeater items have been fully loaded. The short “Wait” action may be necessary in this case to make sure the filter is completely done being applied before the items’ panel states are changed, but hopefully someone is able to come up with a smoother solution to this!

1 Like