Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TagBox inside a Matrix Detail Form - An exception occurs when a Matri… #7229

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/question_tagbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class QuestionTagboxModel extends QuestionCheckboxModel {
}
public clearValue(): void {
super.clearValue();
this.dropdownListModel.clear();
this.dropdownListModel?.clear();
}
public get showClearButton(): boolean {
return this.allowClear && !this.isEmpty() && (!this.isDesignMode || settings.supportCreatorV2);
Expand Down
34 changes: 34 additions & 0 deletions tests/question_tagbox_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MultiSelectListModel } from "../src/multiSelectListModel";
import { PopupBaseViewModel } from "../src/popup-view-model";
import { _setIsTouch } from "../src/utils/devices";
import { settings } from "../src/settings";
import { QuestionMatrixDynamicModel } from "../src/question_matrixdynamic";

export default QUnit.module("Tagbox question");

Expand Down Expand Up @@ -1446,4 +1447,37 @@ QUnit.test("lazy loading & maxSelectedChoices: Items remains disabled when unsel

done1();
}, onChoicesLazyLoadCallbackTimeOut + callbackTimeOutDelta);
});
QUnit.test("Can clear tagbox value", assert => {
const json = {
elements: [{
"type": "matrixdynamic",
"name": "detailTable",
"columns": [
{
"name": "showDetails",
}
],
"detailElements": [
{
"type": "tagbox",
"name": "detailTypes",
"visibleIf": "{row.showDetails} = 'true'",
"clearIfInvisible": "onHidden",
"requiredIf": "{row.showDetails} = 'true'",
"choices": ["a", "b"]
}
],
"detailPanelMode": "underRow",
"cellType": "text"
}
]
};
const survey = new SurveyModel(json);

const matrix = <QuestionMatrixDynamicModel>survey.getAllQuestions()[0];
const row = matrix.visibleRows[0];
row.showDetailPanel();
const question = row.getQuestionByName("detailTypes");
assert.ok(question, "There is no exception");
});