Make builtin header filters query the DB instead of memory, with IQueryable as datasource

5 posts, 1 answers
  1. KorsG
    KorsG avatar
    8 posts
    Member since:
    Mar 2009

    Posted 17 May 2013 Link to this post

    Hi,

    I am using GridView with an IQueryable datasource, together with the builtin header filters.
    But when filtering, it just filters the loaded memory object instead of the database. 

    I have tried to utilize DynamicLinq, by handling the FilterChanging event like this:

    Private FilterDescriptors As New List(Of FilterDescriptor)
     
    Private Sub GridView1_FilterChanging(sender As Object, e As Telerik.WinControls.UI.GridViewCollectionChangingEventArgs) Handles GridView1.FilterChanging
            e.Cancel = True
            For Each f In e.NewItems.OfType(Of FilterDescriptor)()
                FilterDescriptors.Add(f)
            Next
       LoadData() 'Load data here 
    End Sub

    Then in the LoadData method I have to parse the FilterDescriptor expressions, but this would take some time to get it right, and implementing the various filter operators in DynamicLinq. E.g. the "LIKE" operator needs to be rewritten as ColumnName.Contains(filter) etc.

    If my memory serves correct I believe that KendoUI MVC have some builtin functionality to handle this type of situation.
    Do you have anything similar in the WinForms toolkit ?
    Or do you recommend a different approach ?

    (Using VS2012, .NET4.5, Toolkit v. 2013.1.321.40)
  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 18 May 2013 Link to this post

    Hello KorsG,

    With the built in functionality this will not work as expected,

    I will try to provide a solution for this, but I believe it will require Unbound data.

    Will return with more info when available.

    Best Regards,
    Emanuel Varga MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Anton
    Admin
    Anton avatar
    167 posts
  5. KorsG
    KorsG avatar
    8 posts
    Member since:
    Mar 2009

    Posted 24 May 2013 Link to this post

    Thank you for the responses.

    I also tried binding to a datatable (via. the designmode editor of the grid), but it still queries the memory. 
    So I guess there's only the manual way to go, maybe with unbound data as you suggest @Emanuel.

    It would have been a great feature especially with large datasets and because the builtin filters are superb.

    EDIT:
    It seems a similar request is already made in PITS: http://www.telerik.com/support/pits.aspx#/details/Issue=11402
  6. Answer
    Anton
    Admin
    Anton avatar
    167 posts

    Posted 29 May 2013 Link to this post

    Hi Morten,

    Thank you for writing back.

    Yes. This PITS item is related to your case, so feel free to add your vote for it. The more votes the item receives, the higher it gets in our TODO list.

    Let me know if you have additional questions.

    Regards,
    Anton
    Telerik
    RadChart for WinForms is obsolete. Now what?
Back to Top
UI for WinForms is Visual Studio 2017 Ready