How to autoFit the first column in a Kendo TreeList ONLY if columnwidth < maxInt?

100 Views Asked by At

I have a Kendo TreeList and want to autoFit the first column onDatabound and onExpand. But if the column is going to be brighter than maxInt, it should not fit (and stay the same width). So I want something like

var width = /*treelist.columns[0].width*/;
var max = /*some int*/;
if(width < max){
   treelist.autoFitColumn(0);
}

But I didn't find a simple getWidth() method

Furthermore, it would be nice if there is way to set the width manually (in order to set the max width onDatabound).

1

There are 1 best solutions below

0
On

This will get the width of the first column:

                dataBound:function(e){
                  let column = $('td').first()
                  let columnWidth = column[0].clientWidth