Skip to content

Commit

Permalink
work for #7362 [jQuery] TagBox - Default values are not displayed and…
Browse files Browse the repository at this point in the history
… Tag Box becomes unresponsive
  • Loading branch information
OlgaLarina committed Nov 20, 2023
1 parent b30989c commit 25f6074
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/question_checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,15 @@ export class QuestionCheckboxModel extends QuestionCheckboxBase {
* @see enabledChoices
*/
public get selectedChoices(): Array<ItemValue> {
const val = this.renderedValue as Array<any>;
const visChoices = this.visibleChoices;
const selectedItemValues = this.selectedItemValues;

if (this.isEmpty()) return [];

const val = this.renderedValue as Array<any>;
const allChoices = !!this.defaultSelectedItemValues ? [].concat(this.defaultSelectedItemValues, this.visibleChoices) : this.visibleChoices;
const allChoices = !!this.defaultSelectedItemValues ? [].concat(this.defaultSelectedItemValues, visChoices) : visChoices;
const itemValues = val.map((item) => { return ItemValue.getItemByValue(allChoices, item); }).filter(item => !!item);
if(!itemValues.length && !this.selectedItemValues) {
if(!itemValues.length && !selectedItemValues) {
this.updateSelectedItemValues();
}

Expand Down

0 comments on commit 25f6074

Please sign in to comment.