react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

How to perform a bulk remove on Array Field?

Open Bonfims opened this issue 5 months ago • 2 comments

Prerequisites

What theme are you using?

mui

What is your question?

I was using ArrayFieldTemplate to customize some features on array field, but i realise that i can only remove one item per time.

I made some UI that allow user to select many itens and my intention is to remove all selected itens from array, but ArrayFieldTemplate dont propagate onChange method to make changes on formData and ArrayFieldItemTemplate only removes one item at the time.

Any ideia how can i make a bulk remove on many array items? Thank you!

Heres an ideia about what i made so far, implementing my own ArrayFieldTemplate and ArrayFieldItemTemplate with mui DataGrid: image image

Bonfims avatar Jan 16 '24 18:01 Bonfims

@Bonfims There really isn't a simple way to do this that I can think of off the top of my head. There are probably a bunch of super hacky, maybe break things way to build it with a custom ArrayField and ArrayFieldTemplate. AND it would probably be easier to build in optional support for a RemoveAll feature. Are you willing to do this?

heath-freenome avatar Jan 26 '24 20:01 heath-freenome

I'm interested in something which I think is quite similar in challenge, bulk addition with a custom ArrayFieldTemplate. Triggering multiple onAddClick events, and ideally being able to populate them as well.

AdeelK93 avatar Mar 30 '24 18:03 AdeelK93