Skip to content

Commit

Permalink
Column width is not showing in property grid fix surveyjs/survey-crea…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Jul 8, 2023
1 parent 415a78c commit 728e0e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/question_matrixdropdowncolumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ export class MatrixDropdownColumn extends Base
this.setPropertyValue("minWidth", val);
}
public get width(): string {
return this.getPropertyValue("width", "");
return this.templateQuestion.width;
}
public set width(val: string) {
this.setPropertyValue("width", val);
this.templateQuestion.width = val;
}
public get colCount(): number {
return this.getPropertyValue("colCount");
Expand Down
15 changes: 15 additions & 0 deletions tests/question_matrixdropdownbasetests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,18 @@ QUnit.test("survey.onPropertyValueChangedCallback on column property changed", f
assert.equal(counter, 2, "callback called, #3");
assert.equal(propertyName, "expression", "expression is changed, #4");
});
QUnit.test("Column width is not loaded, bug in Creator #4303", function (assert) {
const survey = new SurveyModel({
elements: [
{
type: "matrixdropdown",
name: "q1",
columns: [{ name: "col1", width: "222px" }],
rows: [0, 1, 2]
},
],
});
const matrix = <QuestionMatrixDropdownModelBase>survey.getQuestionByName("q1");
assert.equal(matrix.columns.length, 1, "There is one column");
assert.equal(matrix.columns[0].width, "222px", "column width is loaded correctly");
});

0 comments on commit 728e0e2

Please sign in to comment.