Page 1 of 1

[ANGULAR] Value for Update

Posted: Tue Jun 28, 2022 9:07 am
by pkuehne_sharesuite

Good morning.

Is there a way to change the value, that will be transmitted to the server?

For example I have a column with a combo that has mutliple users.
I still want to have the complete user object as value in the combo.
But if someone changes the user inside the combo, it should only commit the ID of the user as change to the server.

Also is it possible to change the format of the value that will be transmitted to the server? (not the displayFormat)

Greetings,
Phil


Re: [ANGULAR] Value for Update

Posted: Tue Jun 28, 2022 12:19 pm
by arcady

Combo has valueField which can be any field of the store.
And if the configured field keeps objects then an object will be returned from combo.value.

Then when persisting a model to the server its field values can be serialized if the field has serialize function provided.


Re: [ANGULAR] Value for Update

Posted: Tue Jun 28, 2022 12:20 pm
by arcady

You are asking of Bryntum Grid product, correct?


Re: [ANGULAR] Value for Update

Posted: Tue Jun 28, 2022 12:43 pm
by pkuehne_sharesuite

Yeah its about Bryntum Grid.

Can you show me a small example how to implement the serialize function?


Re: [ANGULAR] Value for Update

Posted: Tue Jun 28, 2022 1:22 pm
by arcady
const store = new Store({
    fields : [
        { name : 'foo', serialize : value => value ? value.id : value }
    ]
});

Re: [ANGULAR] Value for Update

Posted: Tue Jun 28, 2022 1:32 pm
by pkuehne_sharesuite

Perfect. This works fine.
Thanks :)


Re: [ANGULAR] Value for Update

Posted: Wed Jul 27, 2022 2:18 pm
by pkuehne_sharesuite

One more question here.
The store does not commit a change, when I remove the value with the clear button.

Is there something that I need to configure?


Re: [ANGULAR] Value for Update

Posted: Wed Jul 27, 2022 2:32 pm
by tasnim

Hi,
You can listen for a change by listening to https://www.bryntum.com/docs/grid/api/Core/widget/Combo#event-change