[BUGFIX] issues with option create
This commit is contained in:
parent
72f172e4a2
commit
f3b0c74bbc
@ -26,9 +26,8 @@ function selectBoatChange() {
|
|||||||
noChoicesText: 'Keine Ergebnisse gefunden',
|
noChoicesText: 'Keine Ergebnisse gefunden',
|
||||||
itemSelectText: 'Zum Auswählen klicken',
|
itemSelectText: 'Zum Auswählen klicken',
|
||||||
callbackOnCreateTemplates: function () {
|
callbackOnCreateTemplates: function () {
|
||||||
console.log('here');
|
|
||||||
return {
|
return {
|
||||||
option: ({ label, value, customProperties, active, disabled, }: Item) => {
|
option: ({ label, value, customProperties, active, disabled, }: any) => {
|
||||||
const opt: HTMLOptionElement = Choices.defaults.templates.option.call(
|
const opt: HTMLOptionElement = Choices.defaults.templates.option.call(
|
||||||
this,
|
this,
|
||||||
{ label, value, customProperties, active, disabled }
|
{ label, value, customProperties, active, disabled }
|
||||||
@ -39,21 +38,15 @@ function selectBoatChange() {
|
|||||||
(option: HTMLOptionElement) => option.value === value
|
(option: HTMLOptionElement) => option.value === value
|
||||||
)[0];
|
)[0];
|
||||||
|
|
||||||
const selectedValue = Number(originalOption.dataset.amount_seats);
|
const rowers = Number(originalOption.dataset.amount_seats) - 1;
|
||||||
const rowers = Number(selectedValue) - 1;
|
|
||||||
console.log(rowers);
|
|
||||||
choiceObjects['newrower'].config.maxItemCount = rowers;
|
choiceObjects['newrower'].config.maxItemCount = rowers;
|
||||||
choiceObjects['newrower'].removeActiveItems(rowers);
|
|
||||||
|
|
||||||
console.log(choiceObjects['newrower']);
|
|
||||||
|
|
||||||
(rowers === 0 ? choiceObjects['newrower'].disable() : choiceObjects['newrower'].enable());
|
(rowers === 0 ? choiceObjects['newrower'].disable() : choiceObjects['newrower'].enable());
|
||||||
|
|
||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
} as any);
|
||||||
|
|
||||||
choiceObjects[boatSelect.id] = boatChoice;
|
choiceObjects[boatSelect.id] = boatChoice;
|
||||||
|
|
||||||
@ -66,19 +59,6 @@ function selectBoatChange() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
choiceObjects[shipmasterSelect.id] = shipmasterChoice;
|
choiceObjects[shipmasterSelect.id] = shipmasterChoice;
|
||||||
|
|
||||||
if(boatChoice) {
|
|
||||||
boatChoice.passedElement.element.addEventListener('change', function(event) {
|
|
||||||
console.log(event);
|
|
||||||
const selectedElement = boatSelect as HTMLSelectElement;
|
|
||||||
const opt = selectedElement.options[selectedElement.selectedIndex];
|
|
||||||
const selectedValue = (<HTMLOptionElement>opt).dataset.amount_seats;
|
|
||||||
const rowers = Number(selectedValue) - 1;
|
|
||||||
choiceObjects['newrower'].config.maxItemCount = rowers;
|
|
||||||
choiceObjects['newrower'].removeActiveItems(rowers);
|
|
||||||
(rowers === 0 ? choiceObjects['newrower'].disable() : choiceObjects['newrower'].enable())
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initBoatActions() {
|
function initBoatActions() {
|
||||||
|
Loading…
Reference in New Issue
Block a user