clean up + make maxitemcount in sidebar work
This commit is contained in:
parent
40f1d436fc
commit
74dabae390
@ -84,7 +84,6 @@ function reloadPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setMaxAmountRowers(name: string, rowers: number) {
|
function setMaxAmountRowers(name: string, rowers: number) {
|
||||||
console.log("called fct: name="+name+"; rowers="+rowers);
|
|
||||||
if(choiceObjects[name]) {
|
if(choiceObjects[name]) {
|
||||||
choiceObjects[name].removeActiveItems(-1);
|
choiceObjects[name].removeActiveItems(-1);
|
||||||
//let curSelection = choiceObjects[name].getValue(true);
|
//let curSelection = choiceObjects[name].getValue(true);
|
||||||
@ -131,7 +130,6 @@ function setMaxAmountRowers(name: string, rowers: number) {
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
console.log(choiceObjects["newrower"].config.maxItemCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initBoatActions() {
|
function initBoatActions() {
|
||||||
@ -180,31 +178,9 @@ function initNewChoice(select: HTMLInputElement) {
|
|||||||
noChoicesText: 'Keine Ergebnisse gefunden',
|
noChoicesText: 'Keine Ergebnisse gefunden',
|
||||||
itemSelectText: 'Zum Auswählen klicken',
|
itemSelectText: 'Zum Auswählen klicken',
|
||||||
placeholderValue: 'Ruderer auswählen',
|
placeholderValue: 'Ruderer auswählen',
|
||||||
maxItemCount: -1, //TODO
|
maxItemCount: select.dataset.seats,
|
||||||
maxItemText: (maxItemCount) => {
|
maxItemText: (maxItemCount) => {
|
||||||
return `Nur ${maxItemCount} Ruderer können hinzugefügt werden`;
|
return `Nur ${maxItemCount} Ruderer können hinzugefügt werden`;
|
||||||
},
|
|
||||||
callbackOnCreateTemplates: function () {
|
|
||||||
return {
|
|
||||||
option: ({ label, value, customProperties, active, disabled, }: any) => {
|
|
||||||
const opt: HTMLOptionElement = Choices.defaults.templates.option.call(
|
|
||||||
this,
|
|
||||||
{ label, value, customProperties, active, disabled }
|
|
||||||
);
|
|
||||||
|
|
||||||
// We get the original <option> from choicejs
|
|
||||||
//const originalOption: HTMLOptionElement = this._presetOptions.filter(
|
|
||||||
// (option: HTMLOptionElement) => option.value === value
|
|
||||||
//)[0];
|
|
||||||
//
|
|
||||||
//const rowers = Number(originalOption.dataset.amount_seats);
|
|
||||||
//const isShipmasterSteering = originalOption.dataset.default_shipmaster_only_steering;
|
|
||||||
|
|
||||||
//setMaxAmountRowersoselect.id, curr_boat_rowers, isShipmasterSteering);
|
|
||||||
|
|
||||||
return opt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
callbackOnInit: function() {
|
callbackOnInit: function() {
|
||||||
this._currentState.items.forEach(function(obj){
|
this._currentState.items.forEach(function(obj){
|
||||||
|
Loading…
Reference in New Issue
Block a user