Bug #89586
closedDate time picker JavaScript is not initialised when loading an inline record
100%
Description
It seems like the DateTimePicker is not initialised when it is loaded via Ajax as part of an inline record.
The following definition leads to this behaviour:
I have a person record 'tx_example_domain_model_person', which has the following field definition:
'vita' => [
'label' => 'CV Elements',
'config' => [
'type' => 'inline'
'foreign_table' => 'tx_example_domain_model_cvelement'
]
]
With the foreign table having a TCA definition like this:
return [
'ctrl' => [
'title' => 'CV element'
],
'columns' => [
'from' => [
'label' => 'from',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'dbType' => 'date',
'eval' => 'date'
]
],
'to' => [
'label' => 'to',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'dbType' => 'date',
'eval' => 'date'
]
],
'title' => [
'label' => 'Title',
'config' => [
'type' => 'input',
]
],
],
'types' => [
0 => ['showitem' => 'from,to,title']
]
];
When creating a new cv element within the person record, the fields are loaded via Ajax. So far, so good.
The problem lies within the date fields, which rely on their JavaScript to be loaded to work correctly.
After loading the fields via Ajax, nothing happens when clicking into the date picker field or on the date picker icon.
It seems like the JavaScript is not correctly initialised for those inline records.
DateTimePicker.ts seems to be prepared (at least according to comments within it) to initialise newly added date picker fields, but maybe it is not called after loading the inline record.
I also tested adding a slug field, which comes with JavaScript, but that doesn't seem to be affected, so it is probably a problem specific to how the InputDateTimeElement is handled for inline records.