Our powerful JS Calendar component


Post by SHQK »

I follow the Calendar demo and I saw In Event Edit of Bryntum Calendar have Calendar field display with name,
But when submit event, this field submit with a Id,
So how can I custom a field like this in event edit, display with name and submit with its id

Attachments
aaa.PNG
aaa.PNG (28.62 KiB) Viewed 851 times

Post by mats »

Can you please describe in more details what you need. Do you want to add a new field? This guide describes how to customize the event editor dialog: https://bryntum.com/docs/calendar/#Calendar/guides/customization/eventedit.md


Post by SHQK »

mats wrote: Sun May 23, 2021 1:31 pm

Can you please describe in more details what you need. Do you want to add a new field? This guide describes how to customize the event editor dialog: https://bryntum.com/docs/calendar/#Calendar/guides/customization/eventedit.md

Ya, I want add a new field,
For example, I have a array object like this:

[
	{
		id: 1,
		name: Service 1
	},
	{
		id: 2,
		name: Service 2
	},
	{
		id: 3,
		name: Service 3
	}
]

I can show name of this this object in my custom field,
But I want when I chose Service 1 then click button Save, I want submit id = 1 to my database

Attachments
bbb.PNG
bbb.PNG (14.54 KiB) Viewed 841 times

Post by mats »

Please see docs https://bryntum.com/docs/scheduler/#Core/widget/Combo

You should configure the combo with the displayField and valueField.

Please be aware that when populating the Combo with objects or records you have to configure valueField and displayField to point to the correct field names in your data.

If you did this and it still doesn't work, please post your full code.


Post by SHQK »

mats wrote: Sun May 23, 2021 6:01 pm

Please see docs https://bryntum.com/docs/scheduler/#Core/widget/Combo

You should configure the combo with the displayField and valueField.

Please be aware that when populating the Combo with objects or records you have to configure valueField and displayField to point to the correct field names in your data.

If you did this and it still doesn't work, please post your full code.

Many thanks for your help, it's working but I have another question,
I config nameField like that

    
eventEdit = { items: { nameField: { type: 'combo', label: "Customer Name", primaryFilter: { operator: '*' }, items: [{ value: "Id", text: "Display text" }], displayField: "text" }, } }

But whent I submit event, this event display in Calendar with Id ( attachment )
So how can I change this to display with text that I chose in Combobox

Attachments
cccc.PNG
cccc.PNG (22.87 KiB) Viewed 837 times

Post by alex.l »

Hi SHQK,

I find it correct, because you use combo.value as a value to display in your title, but value is ID, not text. This is more about a business logic of your application, there is no generic solution may be given. One of possible solutions may be to use custom renderer and pick up a text field value from your store to show it in your title, or maybe save name instead of id, if you need this information... But usually name field contains a name, and id contains an id, try to find a workaround depends on the business logic of your app.

Please check these:
https://bryntum.com/docs/calendar/#Scheduler/view/mixin/SchedulerEventRendering#config-eventBodyTemplate
https://bryntum.com/docs/calendar/#Scheduler/view/mixin/SchedulerEventRendering#config-eventRenderer

One more thing here: please don't use names for your custom fields which our build-in fields used. It may caused unexpected behaviour since our build-in fields may contain extra logic or may rely on the behaviour of a field with the type it has been originally implemented.
Better to hide our internal fields and add your own with your own logic if required.

All the best,
Alex

All the best,
Alex


Post Reply