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

filtering and grouping ria services

1 Answer 49 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David Ocasio
Top achievements
Rank 2
Veteran
David Ocasio asked on 27 Jul 2010, 04:13 AM

Ive copied the code from the q2 2010 silverlight 4 demo   for syncing the filters between the domain data source and the grid.

I also see some code there for loading a collection with distinct values. it seems to me that this a bit of a cheat and the code is consuming the results of a query that is returning the distinct values. am i mistaken or is there some hidden functionality for gathering all the distinct values irregardless of the paging

Private collection As New RadObservableCollection(Of String)()
        Private Sub RadGridView1_DistinctValuesLoading(sender As Object, e As Controls.GridView.GridViewDistinctValuesLoadingEventArgs)
            collection.Clear()
            e.ItemsSource = collection
  
            Dim context As NorthwindDomainContext = DirectCast(DomainDataSource1.DomainContext, NorthwindDomainContext)
            context.DistinctValues.Clear()
            Dim loadOperation As System.ServiceModel.DomainServices.Client.LoadOperation(Of DistinctValue) = context.Load(context.GetDistinctValuesQuery(e.Column.UniqueName))
            AddHandler loadOperation.Completed, AddressOf Me.Completed
        End Sub
  
        Private Sub Completed(sender As Object, e As EventArgs)
            Dim context As NorthwindDomainContext = DirectCast(DomainDataSource1.DomainContext, NorthwindDomainContext)
  
            Dim values As IEnumerable(Of String) = From i In context.DistinctValues.OfType(Of DistinctValue)() _
                Select i.Value
            collection.AddRange(values)
        End Sub
  
        Private Sub DomainDataSource1_LoadedData(sender As Object, e As System.Windows.Controls.LoadedDataEventArgs)
            If e.HasError Then
                'Avoid showing exceptions when data exceeds URI length limitations /e.g adding too many filter descriptors/
                e.MarkErrorAsHandled()
            End If
        End Sub
    End Class
End Namespace

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 27 Jul 2010, 06:34 AM
Hi,

The idea of this code is to call a server side method which will return all distinct values for specific column no matter of the paging. 

Sincerely yours,
Vlad
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
David Ocasio
Top achievements
Rank 2
Veteran
Answers by
Vlad
Telerik team
Share this question
or