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

GridView doesn't show filter

5 Answers 128 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Taher
Top achievements
Rank 1
Taher asked on 23 Jan 2011, 04:03 PM
Dear Telerik team:
Please i face error with GridView, I have two DataCoulmn one has string values and the other hold Enum values, 
The column head doesn't show filter control and i can't group using any column, I set filter allowed to true and i have every thing configured correctly but i still can't filter or group, please help me

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 24 Jan 2011, 07:53 AM
Hello,

 Most probably DataType for this column is null for some reason. 

Greetings,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Taher
Top achievements
Rank 1
answered on 24 Jan 2011, 01:08 PM
I'am sure no null data in the Column and the enum doesn't allow null value/
0
Ruan
Top achievements
Rank 1
answered on 01 Apr 2011, 10:19 AM
Hi

I am facing a similar, if not the exact same, error.

Model: MVVM
Telerik Controls: 2011-Q1 

The ItemsSource for my RadGridView is bound to a Collection in the ViewModel.
AutoGenerateColumns is set to false.
IsFilteringAllowed is set to true
I'm specifying the number of columns and editing their respective cell templates.
The content of the cells are bound to the items inside of the collection.
This all works beautifully.

The problem comes in when trying to filter the data inside the grid.
In Blend the Filter is visible, although, when I debug the project, or in VS2010, there is no filter in any column header, even though I specify that the columns are filterable.

Below is how i specify the columns:

            
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Subject" Width="*" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" IsFilterable="True">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Subject}"/>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Due Date" Width="*"  HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" IsFilterable="True">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding EndDate, Converter={StaticResource DateTimeToStringConverter}}"/>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Status" Width="*"  HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" IsFilterable="True">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Status}"/>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Priority" Width="*"  HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" IsFilterable="True">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Priority}"/>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>

I'm probably doing something wrong somewhere (in fact I'm certain of it), the problem is that I have no idea where...
(I've thought of specifying the FilteringControl, but again I do not know what value to implement there)

Any help would very much be appreciated.
0
Rossen Hristov
Telerik team
answered on 01 Apr 2011, 10:27 AM
Hello Ruan,

In order to enable filtering you will have to specify the DataType of each column.

If you were using a DataMemberBinding, that would work out of the box, but since you are not -- RadGridView does not know what kind of thing will be displayed in each column.

Try to specify a DataType for each column and see how it goes.

All the best,
Ross
the Telerik team
0
Ruan
Top achievements
Rank 1
answered on 01 Apr 2011, 10:54 AM
Thank you very much Ross!

DataMemberBinding was the keyword in your response.

My new ColumnSpecifications looks as follows:

            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Subject" Width="*" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" 
                                            IsFilterable="True" DataMemberBinding="{Binding Subject}" EditTriggers="None"/>
                <telerik:GridViewDataColumn Header="Due Date" Width="*"  HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" 
                                            IsFilterable="True" DataMemberBinding="{Binding EndDate}" EditTriggers="None"/>
                <telerik:GridViewDataColumn Header="Status" Width="*"  HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" 
                                            IsFilterable="True" DataMemberBinding="{Binding Status}" EditTriggers="None"/>
                <telerik:GridViewDataColumn Header="Priority" Width="*"  HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"
                                            IsFilterable="True" DataMemberBinding="{Binding Priority}"/>
            </telerik:RadGridView.Columns>

And the good news is that the filters work!

Problem solved.

Thanks again.
Tags
GridView
Asked by
Taher
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Taher
Top achievements
Rank 1
Ruan
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or