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

Query Grid DataSource without affecting view

1 Answer 374 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Grant asked on 03 Nov 2017, 08:43 AM

Hi, 

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?

Thanks,
Grant

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 07 Nov 2017, 06:33 AM
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.

http://dojo.telerik.com/AgIKEV

I hope this approach is helpful.

Regards,
Stefan
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.
Tags
Data Source
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Stefan
Telerik team
Share this question
or