ResizeToFit with GridTemplateColumn doesn't work correctly

4 posts, 0 answers
  1. Sébastien
    Sébastien avatar
    12 posts
    Member since:
    Apr 2016

    Posted 01 Jun Link to this post

    Hello,

    I use the method ResizToFit to resize all columns in event gridCreated but it doesn't work correctly for the GridTemplateColumn.

    The code is:

    aspx:                        

    <telerik:GridTemplateColumn UniqueName="EmailSendDate" HeaderText="Sent: ">
    <ItemTemplate>
        <asp:Label runat="server" ID="lblSendStatus" />
    </ItemTemplate>

    <ItemStyle Wrap="True" HorizontalAlign="Left" />
    <AlternatingItemStyle Wrap="True" HorizontalAlign="Left" />
    <HeaderStyle Wrap="False" HorizontalAlign="Left" />
    <FooterStyle Wrap="False" HorizontalAlign="Left" />
    <ClientSettings EnableRowHoverStyle="True" AllowKeyboardNavigation="True">
        <Selecting AllowRowSelect="True"/>   
        <ClientEvents OnGridCreated="gridCreated" />                   
        <Scrolling AllowScroll="true" UseStaticHeaders="True" ScrollHeight="475px"/>              
        <Resizing AllowColumnResize="True" ClipCellContentOnResize="False"     AllowResizeToFit="True" EnableRealTimeResize="False" ResizeGridOnColumnResize="False" />
        <ClientMessages ColumnResizeTooltipFormatString="" DragToResize="" />
    </ClientSettings>

    The label may contain nothing or a datetime or an error text.

    javascript:

    var columns = Grid.get_masterTableView().get_columns();
    for (var i = 0; i < columns.length; i++) {
        columns[i].resizeToFit();
    }

    When the column contain the datetime, the column is cut between the date and the time. When I manually enlarged column, just a little, it's ok (The time come beside the date).

    Any suggestions?

    Thanks in advance

    Seb

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 06 Jun Link to this post

    Hello,

    The resizeToFit method works properly on my end for TemplateColumns and we are not bale to replicate the issue you have described. can you please try to enable the ResizeGridOnColumnReisze and see of this makes any difference.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sébastien
    Sébastien avatar
    12 posts
    Member since:
    Apr 2016

    Posted 06 Jun Link to this post

    Hello,

    Thank you for your reply.

    I solved the problem by giving a fixed width with:

    masterTable.resizeColumn(6, 140);

    Thank you

     

     

  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 07 Jun Link to this post

    Hi,

    We are glad you were able to fix the issue eon your end. Do not hesitate to contact us back in case furtehr assistance is needed.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top