Query Grid DataSource without affecting view

2 posts, 1 answers
  1. Grant
    Grant avatar
    111 posts
    Member since:
    Jul 2016

    Posted 03 Nov 2017 Link to this post


    Id like to "query" the data of a dataSource that is attached to a Grid, without actually applying the results.

    Maybe its better to say, I want to execute a filter() to determine how many results match my search criteria without applying the filter results to the grid.

    Im sure I could execute a filter, read the data from the view, then clear the filter, but that method just seems wrong.

    Is such a thing possible?


  2. Answer
    Stefan avatar
    1963 posts

    Posted 07 Nov 2017 Link to this post

    Hello, Grant,

    In this scenario, I can suggest having a second dataSource instance which will have the same data as the original one. For example, apply the filter to the second dataSource, than use the data method to check the number of the item after the filtering and then if they match the criteria to apply the same filter to the actual Grid dataSource.

    To ensure that no additional requests will be made, use the Grid dataSource data to populate the second dataSource. Also, as the second dataSource is making only data manipulations without making changes to the DOM this should not cause any noticeable performance issues.


    I hope this approach is helpful.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top