Declined
Last Updated: 02 Oct 2024 08:08 by ADMIN
alex
Created on: 20 Aug 2024 11:55
Category: Kendo UI for jQuery
Type: Bug Report
0
kendo treelist autofitcolumn issue

i've tried to apply autoFitColumn method for treelist accordingly to the documentation, https://docs.telerik.com/kendo-ui/api/javascript/ui/treelist/methods/autofitcolumn#autofitcolumn , and seems it assumes only "simple" columns structure, i.e. no nested headers.

 

9 comments
ADMIN
Neli
Posted on: 02 Oct 2024 08:08

Hi Christoph,

Thank you for providing the runnable examples.

Please note that in the Grid API autoFitColumn and autoFitColumns are separate methods:

- https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/autofitcolumn

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/autofitcolumns

While the autoFitColumn is present in the TreeList API, the autoFitColumns is not yet supported.

For example, if you try to use the autoFitColumn method in the Grid, the same way as in the TreeList, the result will be the same. In the Dojo example linked here, I used your Dojo with the Treelist from your last reply but replaced the component with the Grid. As you will see, using the same approach both components have the same result. As mentioned previously when the autoFitColumn method is used you need to remove the width from the columns configuration of the component.

In order to have the same result in TreeList as in the Grid, the TreeList component should provide the same method (autoFitColumns). With the above said I am changing the status of the bug report to 'Declined'. However, I logged a new Feature request item for providing a built in support for autoFitColumns method and have the same functionality as in the Grid. I would recommend you vote for it in the link below:

- https://feedback.telerik.com/kendo-jquery-ui/1666191-provide-support-for-autofitcolumns-method-in-treelist

I remain at your disposal in case you have any additional questions on the matter. 

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Christoph
Posted on: 25 Sep 2024 09:54

Hi

 

grid with fixed column length:

https://dojo.telerik.com/uPUXawoJ/3

 

the same, but tree

https://dojo.telerik.com/axocUvuQ

 

ADMIN
Neli
Posted on: 25 Sep 2024 07:57

Hi Christoph,

Could you please provide more details about the scenario and configuration where the Grid autoFitColumn is working and the TreeList does not? I tested the configuration provided in the thread on 27 August and the Grid appearance is the same as in the TreeList in case the widths are not removed from the configuration. You could take a look at the Dojo example linked here - https://dojo.telerik.com/@NeliK/iXOXExEv. I also tested different configurations but i didn`t manage to find a scenario where the behavior of the component is different. Thus, it would be helpful if you could provide more details on the matter.

Looking forward to your reply.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Christoph
Posted on: 18 Sep 2024 13:19

Hi

I understand that it's resource intensive, but our users like this feature.

Disabling scrolling is not an option, people want to have full control on the tree.

I think it's a defect, when autofit doesn't work, if developer predefines column width. Also, this conflicts with grid, where autofit works in any case.

ADMIN
Nikolay
Posted on: 10 Sep 2024 10:15

Hi Alex,

My name is Nikolay and I will get hold of this thread while Neli is out of the office.

 Auto-fitting all columns at once is a resource-intensive operation and is generally not recommended. A better option is to auto-fit only a few columns that have the most variable content in terms of length.

Alternatively, you can disable scrolling and allow the browser to adjust all column widths automatically, according to their content. 

Dojo demo: https://dojo.telerik.com/ADEMUjEy

I hope this helps.

Regards,
Nikolay
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

alex
Posted on: 03 Sep 2024 10:37

Hi

oh yes, it's clear, that we call autofit only after component is ready.

Maybe my example was not that clear, but in reality, in our system we render button for users at the top of grid/tree, which calls autofit.

There can be multiple reasons, why developer decides to explicitly set the width for some columns, and telling people "hey, now you can't use autofit" looks a bit strange.

Also, even if developers don't set the width explicitly, it can still come after save/restore tree options via persist state, so autofit will stop working again.

Also there're no problems like this in grid...

 

 

ADMIN
Neli
Posted on: 03 Sep 2024 10:19

Hi Alex,

In order for the autoFitColumn method to work as expected you need to remove the width from the columns configuration. Also you need to ensure that the component is entirely rendered by the time you are using the method. For example, if you need to fit the columns on initialization you can handle the databound event of the TreeList and use the autoFitColumns method there. Below is an example:

 dataBound: function() {
         for (var i = 0; i < this.columns.length; i++) {
                this.autoFitColumn(i);
         }
 },

Here you will find the modified Dojo - https://dojo.telerik.com/@NeliK/UZAXUHeH

Please use the same approach on your side and let me know about the result. 

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

alex
Posted on: 27 Aug 2024 11:56

looks like this method "doesn't know" about multicolumn headers.

I've tried to prepare dojo example here: https://dojo.telerik.com/uPUXawoJ

as you can see, it fixes all columns to 20 px, and then calls fitColumn, which actually works for only one column.

ADMIN
Neli
Posted on: 27 Aug 2024 07:19

Hello Alex,

Could you please provide more details about your scenario and the structure you are trying to use in the TreeList headers? The example in the API works as expected, thus I will need more information regarding the reported issue. It will be very helpful if you could modify the Dojo example linked here in order to replicate the issue and send it back for a review. 

Looking forward to your reply.

Regards,
Neli
Progress Telerik

Do you have a stake in the designеr-developer collaboration process? If so, take our survey to share your perspective and become part of this global research. You’ll be among the first to know once the results are out.
-> Start The State of Designer-Developer Collaboration Survey 2024