Auto adjust column widths in treetable

I am having problems with auto adjusting column width to data in a treetable.

  1. If the data is flat (all rows are top level only), it works (http://webix.com/snippet/da082a2e).

  2. If the data is nested (two levels), it seems to work for the first column
    (the one with the folders) but not the other columns (http://webix.com/snippet/9555d0b1).

  3. If I put two trees on the same page, one flat and one nested,
    all hell breaks loose (http://webix.com/snippet/7c7395d2):

    • The nested tree is shown in the flat div and vice versa.
    • Column width in data part don’t match header rows
    • nested div has headers but no data
    • clicking ExpandAll above flatTreeDiv (which calls “flatTree.openAll()”)
      puts flat tree there (where it belongs).
    • clicking ExpandAll above nestedTreeDiv (which calls “nestedTree.openAll()”)
      puts nested tree back into the flatDiv (where it DOESN’T belong).

Obviously, I am doing something very wrong, but can’t figure out what. Will be grateful for any ideas.

(2)
Adjust works against visible rows only. You can load the tree in expanded state

http://webix.com/snippet/012f2b3f

or, you can add a handler to readjust data after any row will be expanded.

http://webix.com/snippet/16ddd3d2

(3)
You are using the same structure as column’s config in both treetables, just define a separate objects ( or use webix.copy to make them unique )

http://webix.com/snippet/d2bc0fb3

Will be fixed in Webix 3.0

Awesome, thank you so much!

I am a first-time Webix user (as you may have guessed :slight_smile: and am very impressed with this excellent support (despite the fact that, technically, there is no support for the free version :-).

All my problems are solved, and I’ve learned some extra stuff.

By the way, what is it that will be fixed in 3.0? The need to copy the columns? That might save some new users problems like I had, but once you know the answer, it’s really no big deal.

Thanks again!

The problem (2) will be fixed in Webix 3.0

TreeTable will adjust self, based on values of open and closed branches, there will be no need in extra handlers