How to get control of add button in jsonforms

Hello,
I have a property of type array in my jsonforms. I want the control of Add Button. How can i get it?
Thanks
Dipak

Hi @dijadhav, you have to write a custom renderer for this. Your custom renderer can just wrap the existing one but provide your own implementation of addItem, all the other props can stay the same. I would like to recommend taking a look at our Reusing existing controls guide.

Thanks @ sdirix for help.

1 Like

I did something similar to the listWithDetail renderer so that when you added a new item to the array it auto selects the new item:
I did so by replacing the existing listWithDetail with a custom one and adding a new addItem function:

    const handleAddItem = useCallback(
        (p: string, value: any) => () => {
            addItem(p, value)();
            setSelectedIndex(data)
        },
        [addItem])

and then replacing the place where addItems is used with my new function handleAddItem