Get the data of a filtered datasource

I'm applying a filter on a datasource and I want to retrieve all the filtered data from this datasource.

The filter is correctly apply, my DropDownList is displaying only the filtered item, but when I want to get the data with Javascript, i'm retreiving every data and not only the filtered one.

Here is some code :

dropdownProduct.dataSource.query({ filter: filter }); 

var data = dropdownProduct.dataSource.data();

In the data variable I have all the data. Like I said, the query is working because my dropdown is only displaying the filtered data.

What can I do to only have the filtered data in the data variable?

Upvotes: 7

Views: 11823

Answers (1)

Petur Subev
Petur Subev

Reputation: 20203

This is because the filtering is applied on the client side - and the data method returns all the data. You need to use the view method to retrieve only the visible to the end user data.

Upvotes: 14

Related Questions