filtering and grouping ria services

2 posts, 0 answers
  1. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 26 Jul 2010 Link to this post


    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
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 27 Jul 2010 Link to this post

    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
  3. DevCraft banner
Back to Top