In below snippet , we can change the width of each column by mentioning the width for each id. But can the same thing can be done with help of css property of pivot ?. Because i we dont want to hardcode the width in javascript instead we would like to move it to css file.So if there a change in width in future , we can just change the css file alone
Hello,
If you want to adjust the width of a column to the related content size, you can use the adjust attribute. It is defined for the needed column individually and features the following modes:
- "data" - adjusts column width to the content of the widest item in it;
- "header" - adjusts column width to its header content;
- true - searches for the widest item among data and header(s) and adjusts column width to its content.
More information is here
Also, there is no way to use css
.
@Nastja Thanks …
But the adjust property applies for pivot table ? adjust:true where it can be used for pivot?
https://snippet.webix.com/tcdxqmzf
Please check the related discussion
onBeforeRender: function(config){
var columns = config.header;
for(var i=1; i< columns.length;i++){
columns[i].adjust = true;
columns[i].minWidth = 120;
}
}
@Nastja Thanks…i have this done already … but didnt want to hardcode the width in javascript .Has you mentioned already it is not possible with CSS .Then the below will be the only way
for (var i = 1; i < columns.length; i++) { // ignore the “name” column
columns[i].minWidth = 200;
if (columns[i].id == “str_‘Exception") columns[i].width = 80;
if (columns[i].id == "str’State") columns[i].width = 80;
if (columns[i].id == "str’StartTime") columns[i].width = 180;
if (columns[i].id == "str’FinishTime") columns[i].width = 180;
if (columns[i].id == "str’ViewDependency") columns[i].width = 150;
if (columns[i].id == "str’SLATime") columns[i].width = 80;
if (columns[i].id == "str’_Date”) columns[i].width = 100;
}
Thanks