Onclick behavior

Hello to all. Who knows if it is possible to set up some kind of action on the behavior of clicking on an object, onclick?
How can you filter objects on a page without reloading the page?

Hi @Nikolay-Puh,

AFAIK the lists are refreshed automatically, without page reload (and there is even an option to display new list records). Text labels containing records from the Database collections also change automatically, and text on buttons as well.
Not sure about other components, but I suspect the behaviour is the same.

You can apply some filter by adding an Action for the button, and get the result immediately.

Without knowing the context it’s difficult to tell more :slight_smile:

1 Like

Good. I have a list with tours, and on the same page there is a buttons with tour categories, how can I display only those tours in which there is a clicked category when I click on this or that button categoryes?

Hi @Nikolay-Puh,

The logic is similar to infinite gallery examples.
What I would suggest:

  • you add a “Tour type” field, store a tour type there
  • make a “temporary” variable for storing tour type selected by user. It could be an input field like in gallery howto, or a field in Users collection (I prefer this one)
  • add buttons, and change the value of this variable accordingly
  • in the list, add the custom filter by this variable.

I did an example, used plain text for tour types. Might work with numeric values, or a separate “tour types” collection, but I don’t see a quick way to show “all tours”.

Here is the video:

2 Likes

Thank You @Victor! I will try!

1 Like

I did as you showed, but my version is slightly different, the fact is that I have a list of categories, that is, I have a separate collection with categories, and when I select one category, it is no longer possible to return to all. That is, I do not understand how to implement the “All” button yet!

@Nikolay-Puh yes, I tried it with collections, and didn’t find nice solution. The workaround might be using the same strategy with category naming (you might want to create specific internal field for that). I.e. you have:
Category_Name = “Recreational” — this one will be visible for users
Category_internal_name = “Recreational,All”. — this one is used for logic
Then on button click you put Category_internal_name value into the temporary variable. And then add a custom filter in the list with “contains” condition. This means that if Category_internal_name contain “All” it will be shown.
Not a beautiful solution, from my perspective - you need to administer this Category_internal_name carefully (for example, “All Inclusive” tour will also be filtered with “All” keyword).

But until we have a capability of use Filter1 OR filter2, some workaround is needed :slight_smile:

1 Like

I just asked the question how to implement this.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.