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

Server filter and sort at the same time

1 Answer 156 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Matjaz
Top achievements
Rank 1
Matjaz asked on 16 Jan 2015, 06:48 PM
I enabled server filtering and sorting. How can I filter and sort with one method. I don't want two request to the server.
Is it save to use filter and sort method one after another or there will be multiple request send to server?

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 20 Jan 2015, 09:18 AM
Hi Matjaz,

You can apply multiple operation descriptors, such as filter, sort, group, paging, etc. via the query method of the DataSource. Note that this method will override the existing descriptors, therefore you will need to pass the descriptors for the operations you want to persist. Similar to the following:

dataSource.query({
  sort: { field: "ProductName", dir: "desc" },
  filter: { field: "ProductName", operator: "startswith", value: "Manjimup" },
  page: dataSource.page(),
  pageSize: dataSource.pageSize(),
  group: dataSource.group()
});


Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Matjaz
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or