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

GridViewComboBoxColumn filter

5 Answers 179 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ZooY
Top achievements
Rank 1
ZooY asked on 24 Mar 2013, 06:14 PM
I have RadGridView and GridViewComboBoxColumn.

<telerik:RadGridView>
    <telerik:RadGridView.Columns>
        <telerik:GridViewComboBoxColumn 
            IsFilterable="True"
            DataMemberBinding="{Binding Path=[confirmedcode], Mode=TwoWay}"
            ItemsSourceBinding="{Binding Path=ConfirmedPicklist, Source={StaticResource CurApp}}"
            DisplayMemberPath="Value"
            SelectedValueMemberPath="Key">
            <telerik:GridViewComboBoxColumn.FilteringControl>
                <telerik:FilteringControl />
            </telerik:GridViewComboBoxColumn.FilteringControl>
        </telerik:GridViewComboBoxColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>


Items Source is a Dictionary<int, string>
Data Memder is a Dictionary Item.
Filter for that field is displayed, but the filter shown Dictionary Keys. How to make the filter displays the Values ​​of a Dictionary.

5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 25 Mar 2013, 07:23 AM
Hi Roman,

The filter of GridViewComboBoxColumn will try to display the items it knows about - those from the source of the grid, i.e. the property the column is bound to. We made some improvements and if the column's source is set through ItemsSource - the filter will display the values you want. However, in the case of ItemsSourceBinding, the source can be anything from anywhere and the filter is not aware of the values from it.
Why not trying to work with ItemsSource ? ItemsSourceBinding is used only when the source is a property of the business object the grid is bound to. 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ZooY
Top achievements
Rank 1
answered on 25 Mar 2013, 07:48 AM
ItemSource does not work with Dictioary (ComboBox is empty).
0
ZooY
Top achievements
Rank 1
answered on 25 Mar 2013, 07:49 AM
Maybe I can use some event to override the values ​​of the filter?
0
Scott Waye
Top achievements
Rank 2
Veteran
Iron
answered on 26 May 2013, 01:03 PM
I'd also like to know the answer for this.  ItemsSourceBinding is a convenient way to get a filtered view of a master list where the filter is dependent on another value in the row.  If the filter display values cannot be defined when using ItemsSourceBinding, what is the recommended way to achieve this?
0
Maya
Telerik team
answered on 30 May 2013, 08:33 AM
Hi,

The thing is that when you work with ItemsSourceBinding, distinct values in the filtering control cannot be aware (and thus convert) each original value (the one the column is bound to) to a new one (that you want to display - CountryName instead of CountryID for example) since there is no exact and equal connection between a data item and value from the source of the column. And there is no appropriate way for us to notify the grid as the whole logic is inside each customer's business objects.
There is a possibility to convert the original distinct value to a new one (this will be just visual convertion, the data below will be the same) as illustrated in this forum thread. However, this again is appropriate only if you have only one pair of distinct value - item. 
The way to go is to expose a new read-only property that will contain the value to be displayed in the combo box column and set it as FilterMemberPath for the ComboBoxColumn.

Regards,
Maya
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
ZooY
Top achievements
Rank 1
Answers by
Maya
Telerik team
ZooY
Top achievements
Rank 1
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Share this question
or