Skip to content

Commit

Permalink
Fix showInMultipleColumns prop visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Jan 25, 2024
1 parent c94d452 commit 4239e08
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/jsonobject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,10 @@ export class JsonObjectProperty implements IObject {
if (!this.visible || !isLayout) return false;
if (!!this.visibleIf && !!obj) {
if (obj.getOriginalObj) {
obj = obj.getOriginalObj() || obj;
const orjObj = obj.getOriginalObj();
if(orjObj && Serializer.findProperty(orjObj.getType(), this.name)) {
obj = orjObj;
}
}
return this.visibleIf(obj);
}
Expand Down
21 changes: 21 additions & 0 deletions tests/jsonobjecttests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3191,3 +3191,24 @@ QUnit.test("Versions & alternative name", function (assert) {
assert.deepEqual(question.toJSON({ version: "1" }), { name: "q1", testProp: "abc" }, "#5");
Serializer.removeProperty("question", "testProperty");
});
QUnit.test("Test showInMultipleColumns prop visibility", function (assert) {
const survey = new SurveyModel({
elements: [
{
"type": "matrixdynamic",
"name": "matrix",
"columns": [
{
"name": "Column1",
"cellType": "checkbox",
"showInMultipleColumns": true
}
]
}
]
});
const column = survey.getQuestionByName("matrix").columns[0];
const prop = Serializer.findProperty("matrixdropdowncolumn", "showInMultipleColumns");
assert.ok(prop, "property is here");
assert.equal(prop.isVisible("", column), true, "column is visible");
});

0 comments on commit 4239e08

Please sign in to comment.