autoFitColumn doesn't work like double-click column separater

4 posts, 0 answers
  1. Gerry
    Gerry avatar
    33 posts
    Member since:
    May 2017

    Posted 19 Aug 2020 Link to this post

    When you float your mouse cursor over the line that separates two columns in a grid (sometimes) a cursor comes up, it looks like a left arrow, two vertical bars and a right arrow.

    If you then double click, Kendo now does a nice job of auto fitting the column (on the left of the special cursor). This behavior is different from the normal autoFitColumn call, which does not account for sort and filter icons nor the size of the column header.

    How can I get the same auto-fit programmatically?

    [I am unable to get a screenshot that includes the cursor because my Adesso keyboard has no proper print screen button. Every app I have tried requires special mouse activity, causing the special icon to disappear before I can take the screenshot]

  2. Tsvetomir
    Admin
    Tsvetomir avatar
    796 posts

    Posted 21 Aug 2020 Link to this post

    Hi Gerry,

    I can confirm that the resize handle of the grid internally calls the autoFitColumn method. Therefore, the same functionality should be observed in both cases.

    The only difference might be due to the fact that the column is auto-fitted before the actual icon has been rendered. For instance, in the example below, a setTimeout function is used to demonstrate the same:

    https://dojo.telerik.com/uHIJinUp

    I hope you find this helpful.

     

    Kind regards,
    Tsvetomir
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

  3. Gerry
    Gerry avatar
    33 posts
    Member since:
    May 2017

    Posted 21 Aug 2020 in reply to Tsvetomir Link to this post

    Thanks. So I guess whenever the user sorts I might need to resize the column sorted on.
  4. Tsvetomir
    Admin
    Tsvetomir avatar
    796 posts

    Posted 25 Aug 2020 Link to this post

    Hi Gerry,

    Yes. The default functionality of the sorting does not resize the column. It would be unexpected if the sort function resizes a column of the grid. This would lead to weak cohesion and coupling of different segments of the code. 

    Therefore, if you would like to resize a column after sorting, this has to happen manually. Perhaps, in the Sort event of the grid.

     

    Kind regards,
    Tsvetomir
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top