reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

ReactiveList onPageChange event fired when filter applied

Open nestedifsdotcom opened this issue 8 years ago • 7 comments

Issue Type: Bug

Platform:

Web Description: i attached this event on ReactiveList onPageChange={() => { window.scrollTo({ top: 300, behavior: "smooth" }); }} The onPageChange event is fired not only on pagination change but also on filter apply (in my case checking on MultiList).

is there a way to add an event to the pagination only via reactiveSearch?

Reactivesearch version: 2.6.2

nestedifsdotcom avatar Jun 09 '18 18:06 nestedifsdotcom

This is an expected behavior because the results change as you update the selection on MultiList, which causes the page change event to get fired, i.e. if you are on Page 3 and you select a new item in MultiList, you will get to Page 1 in the result components.

onPageChange gets fired whenever there is a change in query, which is either triggered via page change (via interaction) or query change from the subscribed components.

Can you explain your use case - exactly when do you want to scroll to top: 300?

metagrover avatar Jun 11 '18 05:06 metagrover

The top:300 was just for the example sake. what I want to do is to smooth scroll to the top of the ReactiveList

nestedifsdotcom avatar Jun 12 '18 08:06 nestedifsdotcom

okay, but when do you wish to make the page scroll to top? What kind of event should trigger the scrolling?

Should it be when the user manually interacts with the pagination buttons, or at anytime the pagination changes programmatically via query change?

metagrover avatar Jun 12 '18 09:06 metagrover

I want it to scroll when the user manually interacts with the pagination buttons.

nestedifsdotcom avatar Jun 12 '18 11:06 nestedifsdotcom

For now, we will be exposing onClick handlers on pagination buttons to resolve this issue. But going further, v3 should expose the action type as a param with onPageChange to specify the cause of the event trigger. For example:

Action types can be:

QUERY_CHANGE INTERACTION

cc @divyanshu013

metagrover avatar Jun 13 '18 06:06 metagrover

Thank you for your support

nestedifsdotcom avatar Jun 14 '18 12:06 nestedifsdotcom

Added in v2.6.7 🤘

divyanshu013 avatar Jun 15 '18 15:06 divyanshu013