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

RadGrid Column Resize - Parent Div Width

1 Answer 245 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stephen Wright
Top achievements
Rank 2
Stephen Wright asked on 13 Apr 2010, 04:38 PM
I have a RadGrid (Rad Ajax 2009 Q3) that allows its columns to be resizable.  If I drag one column past the point where the javascript will actually resize the column, I still get a tool tip that tells me the width and the parent div tag (of the table) still shrinks.  When I release my mouse, the parent div tag has its width less than the actual table width.  Because the parent div tag has its border set, the right border runs right down the middle of one of my columns.  If I sort the columns, the div tag gets reset correctly, but how can I get it to work without having to do a resort?
<telerik:RadGrid ID="dgLocations" runat="server" AutoGenerateColumns="False" Visible="false"
                    <MasterTableView ShowHeadersWhenNoRecords="False" AllowNaturalSort="false" AllowSorting="true"
                        <SortExpressions> 
                            <telerik:GridSortExpression FieldName="LocationName" SortOrder="Ascending" /> 
                        </SortExpressions> 
                        <Columns> 
                            <telerik:GridBoundColumn UniqueName="LocationCode" 
                                DataField="LocationCode" HeaderText="Code" /> 
                            <telerik:GridBoundColumn UniqueName="LocationName" 
                                DataField="LocationName" HeaderText="Name" /> 
                            <telerik:GridBoundColumn UniqueName="City" 
                                DataField="City" HeaderText="City" /> 
                            <telerik:GridBoundColumn UniqueName="State" DataField="State"  
                                HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderText="State/Province" Resizable="false" /> 
                            <telerik:GridTemplateColumn UniqueName="Select" HeaderText="Select"
                                <ItemStyle  HorizontalAlign="Center" /> 
                                <HeaderStyle HorizontalAlign="Center" /> 
                                <ItemTemplate> 
                                    <onclick="returnValues(<%# Eval("LocationID") %>);" href="#">Select</a> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                        </Columns> 
                    </MasterTableView> 
                    <ClientSettings> 
                        <Resizing AllowColumnResize="true" ClipCellContentOnResize="false" EnableRealTimeResize="true" 
                            ResizeGridOnColumnResize="true" /> 
                    </ClientSettings> 
                </telerik:RadGrid> 


1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 16 Apr 2010, 03:52 PM
Hello Stephen,

To implement the desired functionality, I recommend that you handle the OnColumnResizing client event of the RadGrid and cancel it, if the new width exceeds the width of the parent div.
Another option is to set the ResizeGridOnColumnResize property to false to make the width of the RadGrid constant.

I hope this helps.

Kind regards,
Mira
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Stephen Wright
Top achievements
Rank 2
Answers by
Mira
Telerik team
Share this question
or