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

Column width auto = bug

9 Answers 153 Views
GridView
This is a migrated thread and some comments may be shown as answers.
tomas
Top achievements
Rank 1
tomas asked on 05 Aug 2011, 02:52 PM
Hi Telerik. You can simply simply simulate this bug:

1) create MVVM app.
2) Send the first page of data. Radgridview expands as needed
2) send the second page of data. Radgridvew columns are still expanded although some columns contains no data or contains data which are short (narrow)

Thanks tom

9 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 05 Aug 2011, 03:01 PM
Hi Tomas,

Thank you for reporting this! 
We are aware of similar issue, which has been already logged in our PITS System. I believe that it is related to the described one and you may track its progress from the following link. I would encourage you to vote, which will increase its priority. 



Please excuse us for any inconvenience caused!


All the best,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
tomas
Top achievements
Rank 1
answered on 27 Sep 2011, 04:06 PM
That problem tracked in PITS has nothing to do with my problem. Columns with width set to auto simply does not reflect the displayed data width.
0
Vanya Pavlova
Telerik team
answered on 27 Sep 2011, 04:10 PM
Hello Tomas,

 

Will you try to isolate the problem in a small runnable project and sent it to us in a new support ticket where we can see what might be wrong? We may take a look at it and we will do our best to provide you with an appropriate solution. Any additional information about the grid version you used will be highly appreciated as well. 


Best wishes,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
tomas
Top achievements
Rank 1
answered on 27 Sep 2011, 06:35 PM
Hi Vanya.

I am using 2011.1.315.1040 version.

<Grid Grid.Column="2" Width="500">
 
                                    <telerikGrid:RadGridView Grid.Column="0" x:Name="gwFolderContent"
                                                         ItemsSource="{Binding FolderContent,Mode=OneWay}"
                                                         CanUserDeleteRows="False"
                                                         CanUserInsertRows="False"
                                                         CanUserResizeColumns="False"
                                                         IsReadOnly="True"
                                                         AutoGenerateColumns="False"
                                                         SelectionChanged="gwFolderContent_SelectionChanged"
                                                         GridLinesVisibility="None"
                                                         ShowGroupPanel="False"
                                                         RowIndicatorVisibility="Collapsed"
                                                         GotFocus="gwFolderContent_GotFocus"
                                                         LostFocus="gwFolderContent_LostFocus"
                                                         RowActivated="gwFolderContent_RowActivated"
                                                           
                                                         Width="auto"
                                                        HorizontalAlignment="Stretch"
                                                         VerticalAlignment="Stretch"
                                                         ColumnWidth="auto"
                                                         >
                                        <telerik:RadGridView.Columns>
                                            <telerik:GridViewDataColumn Header="File Name" DataMemberBinding="{Binding Name}"  Width="Auto" >
                                                <telerik:GridViewDataColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal">
                                                            <Image   Source="{Binding FileImgName,Converter={StaticResource prefixStringConverter},ConverterParameter='/images/fileSystem/small/'}"  Stretch="None"/>
                                                            <TextBlock Text="{Binding Name}" Margin="4,0,0,0" VerticalAlignment="Center"  />
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </telerik:GridViewDataColumn.CellTemplate>
                                            </telerik:GridViewDataColumn>
                                            <telerik:GridViewDataColumn Header="Title" DataMemberBinding="{Binding Csc.Title}" Width="Auto" />
                                            <telerik:GridViewDataColumn Header="Attributes" DataMemberBinding="{Binding Csc.Attributes}" Width="Auto" />
                                            <telerik:GridViewDataColumn Header="XML Element" DataMemberBinding="{Binding Csc.XmlElementName}" Width="SizeToCells" />
                                            <telerik:GridViewDataColumn Header="Operation" DataMemberBinding="{Binding Operation}" Width="Auto" >
                                                <telerik:GridViewDataColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <Image   Source="{Binding Csc.SelectedOperationImgName,Converter={StaticResource prefixStringConverter},ConverterParameter='/images/icons16x16/'}"  Stretch="None" ToolTipService.ToolTip="{Binding Csc.SelectedOperation}" />
                                                    </DataTemplate>
                                                </telerik:GridViewDataColumn.CellTemplate>
                                            </telerik:GridViewDataColumn>
                                            <telerik:GridViewDataColumn Header="Modified File" DataMemberBinding="{Binding Csc.ModifiedFilePath}"  MinWidth="100" >
                                                <telerik:GridViewDataColumn.CellTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal" >
                                                            <HyperlinkButton Content="{Binding Csc.ModifiedFilePath}" NavigateUri="{Binding Csc.ModifiedFileUrl}" TargetName="_blank" VerticalAlignment="Center" />
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </telerik:GridViewDataColumn.CellTemplate>
                                            </telerik:GridViewDataColumn>
                                            <telerik:GridViewDataColumn Header="Modified File Title" DataMemberBinding="{Binding Csc.ModifiedTitle}" MinWidth="100" />
 
                                        </telerik:RadGridView.Columns>
                                    </telerikGrid:RadGridView>
 
 
                                </Grid>

I am sending data to gvFolderContentGrid grid (that 500 px wide frame is useless, just for testing). Every new page of data only makes some columns a little bit wider in case that data cannot fit. Columns never shrink to more narrow. Do you understand to my problem?

Also I would like to know, why the grid is not painted all. You can see on the attached picture, that the footer of the grid is missing.

Please excuse my poor english.

Thank you very much.

Tom
0
Vanya Pavlova
Telerik team
answered on 28 Sep 2011, 12:57 PM
Hello Tomas,

 

 


I believe that it would be useful to explain how the GridViewDataColumn's Width property works:


Auto Auto (Default Value) Automatically fits the size according to content
Fill Star ("*") Fills the available space

SizeToHeader Column width is equal to the width of the header cell

SizeToCells Column width is equal to the width of the widest (excluding header) cell

# pixels Sets fixed column width size
 

You may also try to set the Width property of a column to SizeToCells, in this way the column width would be equal to the width of the widest (excluding header) cell as described above. 
Regarding your second question, the problem is related to the RadGridView's grid lines. You have simply removed the gridlines and the rowindicator, however the FrozenIndicator is still visible.
Then you may notice this "gap". This is the remaining space of the Grid when the grid rows do not fill the vertical available space. I would suggest you to remove it through setting the CanUserFreezeColumns property of RadGridView to False. 



Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
tomas
Top achievements
Rank 1
answered on 28 Sep 2011, 02:36 PM
Hi VAnya.

I have already tested this settings (SizeToCells). Columns will never shrink back to more narrow when next page of data contains shorter strings.


Thank you.
Tom
0
Vanya Pavlova
Telerik team
answered on 03 Oct 2011, 12:15 PM
Hi Tomas,

 

Sorry for the late reply. We have spent some time to investigate your case and you are right. Your case is related to a bug, which has been already logged in our PITS System. You may track its progress either by ID(1630) or following this link. I would encourage you to vote and in this way you will affect its priority.



Once again please excuse us for any inconvenience caused! 




Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
tomas
Top achievements
Rank 1
answered on 03 Oct 2011, 12:44 PM
i am not sure, if my problem is related to your already described problem in PITS, but I hope, you know what you are writing. This is such a basic functionality...

Please, is there any way how to publish data according to MVVM model (it means pages of data) in such way to be always visible? = not only expand columns but also shrink them? 

Any html table can do this...

Thank you.

Tom
0
Arpit
Top achievements
Rank 1
answered on 14 May 2012, 01:37 PM
I am also facing the same issue in  version 2011.1.419.40.

Just wanted to know if this issue was fixed, from where should I update my DLLs?
Tags
GridView
Asked by
tomas
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
tomas
Top achievements
Rank 1
Arpit
Top achievements
Rank 1
Share this question
or