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

Filtering only selected rows on load

1 Answer 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Swarna
Top achievements
Rank 1
Swarna asked on 17 Jul 2014, 08:34 PM
I have a grid view
<telerik:RadGridView x:Name="SizingGridView" 
                ItemsSource="{Binding Model.SizingUpchargeModels}"
                Style="{StaticResource BaseGrid}"
                ValidatesOnDataErrors="InViewMode"
                IsSynchronizedWithCurrentItem="True"
                ColumnWidth="*" >
                <telerik:RadGridView.Columns>
                    <telerik:GridViewCheckBoxColumn IsSortable="False" Header="Selected" DataMemberBinding="{Binding Selected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" EditTriggers="CellClick" AutoSelectOnEdit="True"/><telerik:GridViewDataColumn Header="Size" IsReadOnly="True" DataMemberBinding="{Binding Size}" IsSortable="False" />
                    <telerik:GridViewDataColumn Header="Upcharge" DataFormatString="C3" 
                                            DataMemberBinding="{Binding UpchargeAmount, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=False, TargetNullValue={x:Static sys:String.Empty}}"
                                            Style="{StaticResource GridErrorDisplay}" EditTriggers="CellClick" IsSortable="False" >
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <commonControls:RadGridMaskedNumericInput Style="{StaticResource GridThreeDecimalAmountTwoDigitsNumericTextEntry}"  IsReadOnly="{Binding Selected,Converter={StaticResource InverseBooleanConverter}}"
                                Value="{Binding Path=UpchargeAmount, TargetNullValue={x:Static sys:String.Empty}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=False}"/>
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
I need to display only show rows Selected = true on initial load. When I click the filter option it should have the checkbox next to true selected. Now the user can unselect true/ select false or clear filter etc.
How can I achieve this? 


1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 18 Jul 2014, 09:12 AM
Hello,

You should apply the filtering criteria initially through specifying a IColumnFilterDescriptor. That way once you open the FilteringControl, you will have information on the criteria currently applied. 

Please check our online documentation on Programmatic Filtering for more information on the matter. You can also find an example on the WPF Demos.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Swarna
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or