Page 1 of 1

EventEdit combo return Object

Posted: Fri Jun 21, 2019 3:39 pm
by fract
I have a combo and I wish when I select an item that the returned value is the selected object and not just a single field.
{
                type        : 'combo',
                name        : 'test',
                label       : 'Test',
                store       : [
                  {id:"1", name:"name1", value:"value1"}, 
                  {id:"2", name:"name2", value:"value2"},
                  {id:"3", name:"name3", value:"value3"}
                ],
                displayField: 'name',
                index       : 1,
            }

I want the returned value to be of this type :
{id:"1", name:"name1", value:"value1"}

I am using angular 7.

thank in advance

Re: EventEdit combo return Object

Posted: Sat Jun 22, 2019 12:57 pm
by mats
Sounds like you are looking for the 'record' property: https://bryntum.com/docs/scheduler/#Common/widget/Combo#property-record

Re: EventEdit combo return Object

Posted: Mon Jun 24, 2019 10:15 am
by fract
how to assign this value directly to the event in creation or modification?
thank in advance

Re: EventEdit combo return Object

Posted: Mon Jun 24, 2019 11:55 am
by pmiklashevich
You can override onBeforeSave template method our subscribe to beforeeventsave. By default EventEditor will try to apply value to the key provided by `name` property of your widget. In your code snippet it will try to use 'test' and set value, where value is your widget.value according to the valueField
eventRecord.set({ test : value})

Re: EventEdit combo return Object

Posted: Mon Jun 24, 2019 3:35 pm
by fract
with OnBeforeSave, it does not work, the new value is overwritten by the old one

Re: EventEdit combo return Object

Posted: Mon Jun 24, 2019 5:15 pm
by pmiklashevich
I don't see your implementation of OnBeforeSave function. Please provide a runnable testcase based on one of our samples that shows the issue.