mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 01:22:07 +01:00
Populate MultipleChooserPanel from modal results
This commit is contained in:
parent
67ff655111
commit
78b88a605a
@ -16,8 +16,15 @@ export class MultipleChooserPanel extends InlinePanel {
|
||||
$(`#${opts.formsetPrefix}-OPEN_MODAL`).on('click', () => {
|
||||
this.chooserWidgetFactory.openModal(
|
||||
(result) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(result);
|
||||
result.forEach((item) => {
|
||||
this.addForm();
|
||||
const formIndex = this.formCount - 1;
|
||||
const formPrefix = `${opts.formsetPrefix}-${formIndex}`;
|
||||
const chooserFieldId = `${formPrefix}-${opts.chooserFieldName}`;
|
||||
const chooserWidget =
|
||||
this.chooserWidgetFactory.getById(chooserFieldId);
|
||||
chooserWidget.setStateFromModalData(item);
|
||||
});
|
||||
},
|
||||
{ multiple: true },
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user