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

[Solved] gridviewcomboboxcolumn - getting grouping and filtering to work

1 Answer 109 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
robert hutchison
Top achievements
Rank 1
robert hutchison asked on 17 Sep 2010, 06:34 PM
Hi,

Yes, I've seen similar here, but...

  1. We use RIA Services and want to continue doing so (I don't want to convert to MVVM just to get this to work)
  2. We use VB (I don't want to convert the entire app just to get this to work)
  3. I don't think the solution of denormalizing all of my databases is a reasonable solution

This is something that I would think is needed in about 99.99% of about all applications - lookups. We use a RadGridView bound to a DomainDataSource for the "base table" and have another DomainDataSource connected to the "lookup table".

I was told that we needed to dynamically bind the ItemsSource of the GridViewComboBoxColumn in code-behind or we would get that "you need to click it before you see anything" problem. Doing so fixed that problem.

So, here's a little of the XAML (I want to group and sort on the second of the two columns) ...

<riaControls:DomainDataSource AutoLoad="False" Height="0"
        Name="TblSIFObjectPermissionDomainDataSource"
        QueryName="GetTblSIFObjectPermissionsQuery" Width="0">
    <riaControls:DomainDataSource.DomainContext>
        <my:ZISDomainContext />
    </riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
 
<telerikGridView:RadGridView Height="250"
        ItemsSource="{Binding ElementName=TblSIFObjectPermissionDomainDataSource, Path=Data}"
        Name="TblSIFObjectPermissionRadGridView"
        AutoGenerateColumns="False" AutoExpandGroups="True">
    <telerikGridView:RadGridView.Columns>
 
        <telerikGridView:GridViewComboBoxColumn
                IsFilterable="False" IsGroupable="False"
                x:Name="comboSIFObject" Width="*"
                DataMemberBinding="{Binding SIFObjectId}"
                DisplayMemberPath="SIFObjectName"
                SelectedValueMemberPath="RecordID"
                IsReadOnly="True" ShowFieldFilters="False"
                Header="SIF Object Name" />
 
        <telerikGridView:GridViewComboBoxColumn
                IsFilterable="True" IsGroupable="True"
                x:Name="comboSIFWorkgroup" Width="*"
                DataMemberBinding="{Binding SIFObjectId}"
                DisplayMemberPath="SIFWorkingGroup"
                SelectedValueMemberPath="RecordID"
                IsReadOnly="True" ShowFieldFilters="True"
                Header="SIF Working Group"
                GroupMemberPath="SIFWorkingGroup"
                SortMemberPath="SIFWorkingGroup" />

The code behind to set the CB's is a bit crude for now, but it doesn't fully work yet either:

Private Sub TblSIFObjectPermissionRadGridView_DataLoaded(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TblSIFObjectPermissionRadGridView.DataLoaded
 
    Dim Context As ZISDomainContext = DSTblSIFObjectsQuery.DomainContext
    Dim ThisCombo As GridViewComboBoxColumn
 
    ThisCombo = TryCast(TblSIFObjectPermissionRadGridView.Columns(0), GridViewComboBoxColumn)
    ThisCombo.ItemsSource = TryCast(Context.tblSIFObjects, IEnumerable(Of tblSIFObject))
 
    ThisCombo = TryCast(TblSIFObjectPermissionRadGridView.Columns(1), GridViewComboBoxColumn)
    ThisCombo.ItemsSource = TryCast(Context.tblSIFObjects, IEnumerable(Of tblSIFObject))
 
End Sub


...oh, sorry... that's the way I wish I could set it (notice the last two lines of the XAML). What I would like to do is specify the "field to sort on" and the "field to group on" from the Combo Box's data source. But, the combo box is written in such a way that it requires that those two fields must come from the base table's data source. The only value in the base table is the code (not good for grouping or sorting).

This is something that needs to get done with almost every data grid in every application. There has to be a simple way to do this that doesn't involve rewriting the application or reinventing the wheel in some way. This is REAL basic stuff. I must be missing something real basic.

Many thanks,
Rob

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 20 Sep 2010, 01:08 PM
Hi robert,

Please find the answer to your question in the other thread you have started - "Use of GridViewComboBoxColumn" (Ticket ID: 347655).

Sincerely yours,
Stefan Dobrev
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
GridView
Asked by
robert hutchison
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or