Skip to content

Commit

Permalink
#7467 Dropdown With Lazy Loading Within a Dynamic Panel doesn't displ…
Browse files Browse the repository at this point in the history
…ay search results on Mobile

Fixes #7467
  • Loading branch information
novikov82 committed Dec 7, 2023
1 parent c90aa0e commit 541cbdc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/question_dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export class QuestionDropdownModel extends QuestionSelectBase {
protected onVisibleChoicesChanged(): void {
super.onVisibleChoicesChanged();

if (this.popupModel) {
if (!this.isLoadingFromJson && this.popupModel) {
this.dropdownListModel.updateItems();
}
}
Expand Down
26 changes: 26 additions & 0 deletions tests/dropdown_list_model_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DropdownListModel } from "../src/dropdownListModel";
import { ListModel } from "../src/list";
import { PopupModel } from "../src/popup";
import { QuestionDropdownModel } from "../src/question_dropdown";
import { QuestionPanelDynamicModel } from "../src/question_paneldynamic";
import { SurveyModel } from "../src/survey";
import { _setIsTouch } from "../src/utils/devices";

Expand Down Expand Up @@ -890,4 +891,29 @@ QUnit.test("DropdownListModel filterReadOnly", (assert) => {
assert.notOk(dropdownListModel.filterReadOnly);
dropdownListModel.onBlur({ stopPropagation: () => { } });
assert.ok(dropdownListModel.filterReadOnly);
});
QUnit.test("DropdownListModel in panel filterString change callback", (assert) => {
const survey = new SurveyModel({
elements: [
{
type: "paneldynamic",
name: "p",
templateElements: [
{
type: "dropdown",
name: "country",
choicesLazyLoadEnabled: true,
showOtherItem: true,
},
],
},
],
showQuestionNumbers: false,
});
const question = <QuestionPanelDynamicModel>survey.getAllQuestions()[0];
question.addPanel();

const dropdownListModel = (question.panels[0].elements[0] as QuestionDropdownModel).dropdownListModel;
dropdownListModel["listModel"].filterString = "abc";
assert.equal(dropdownListModel.filterString, "abc");
});

0 comments on commit 541cbdc

Please sign in to comment.