community-forum icon indicating copy to clipboard operation
community-forum copied to clipboard

[Feature Request] trigger repeatable events in javascript

Open pxpm opened this issue 3 years ago • 1 comments

Feature Request

What's the feature you think Backpack should have?

I think one easy way of manipulating the repeatable rows, without having to overwrite the whole repeatable blade file is by adding some events into repeatable lifecycle.

The ones I am thinking rigth now is backpack.before_new_repeatable_row(repeatableElement, repeatableFieldGroupClone) and backpack.after_new_repeatable_row(repeatableElement) we can add the order events and row delete events.

Most notable usecases:

  • manually manipulating repeatable values.
  • triggering some custom error if some conditions are met (adding js validation)
  • interface logging.

Have you already implemented a prototype solution, for your own project?

Not yet

Do you see this as a core feature or an add-on?

I think it brings alot of benefits from a very small thing as triggering events on our side. I would say core yes.

pxpm avatar Apr 14 '22 15:04 pxpm

I love it ❤️ This is how we should be thinking in the future. We don't do stuff necessarily, we provide events and hooks, so that people can easily build their own customizations. It's a COULD, but a pretty nice one in principle.

My first pass at events (from your text), for future us:

  • before_repeatable_row_added & after_repeatable_row_added
  • before_repeatable_row_reordered & after_repeatable_row_reordered
  • before_repeatable_row_deleted & after_repeatable_row_deleted

tabacitu avatar Apr 18 '22 06:04 tabacitu