This is a migrated thread and some comments may be shown as answers.

ResizeToFit with GridTemplateColumn doesn't work correctly

3 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sébastien
Top achievements
Rank 1
Sébastien asked on 01 Jun 2016, 10:41 AM

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

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 06 Jun 2016, 11:25 AM
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.
0
Sébastien
Top achievements
Rank 1
answered on 06 Jun 2016, 12:09 PM

Hello,

Thank you for your reply.

I solved the problem by giving a fixed width with:

masterTable.resizeColumn(6, 140);

Thank you

 

 

0
Maria Ilieva
Telerik team
answered on 07 Jun 2016, 01:52 PM
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.
Tags
Grid
Asked by
Sébastien
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Sébastien
Top achievements
Rank 1
Share this question
or