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

Invalid .query() from odata-v4 dataSource

4 Answers 75 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
VAFIR
Top achievements
Rank 1
VAFIR asked on 16 May 2016, 05:32 PM

Working with Kendo UI version 2016.2.504, I have tested two filtering method calls across the same odata-v4 dataSource:

1. via .filter() - gridStage.model.DS.filter(DSfilter()) results in:

/app/odata/vwgriddc_info?%24format=json&%24orderby=dc_name&%24filter=dc_id+eq+109&%24count=true

2. via .query() - gridStage.model.DS.query(DSfilter()) results in:

/app/odata/vwgriddc_info?%24format=json&logic=and&filters%5B0%5D%5Bfield%5D=dc_id&filters%5B0%5D%5Boperator%5D=eq&filters%5B0%5D%5Bvalue%5D=109&%24count=true

 

The former works perfectly; the latter fails to properly encode the filter in odata-v4 format and ignores the existing sort parameter. 

I would prefer to render the return within the .query().then() promise, but have worked around the problem with .filter() and requestEnd/setTimeout.

 

Are there plans to update .query() to support odata-v4?  Or, is there some other sort of work around to this issue.

Thanks!

 

 

4 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 18 May 2016, 06:46 AM

Hello VAFIR,

The difference between the filter and query method is that the later expects an object which contains the appropriate filter, sort, group descriptors and paging information. Where the filter method expects only the filters. Therefore, you cannot pass the filter descriptors directly to the query method, but you need to construct the correct argument value. Please refer to the documentation for more details.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
VAFIR
Top achievements
Rank 1
answered on 18 May 2016, 03:27 PM

Thank you for the assistance, Rosen.  Got it going.  A couple of documentation comments:

1.  The query method documentation should explicitly state that it over-writes all the related dataSource configuration.  IE., a query call without a sort property will actually set the dataSource sort property to {}, not the behavior one would expect from an "optional" parameter.

2. The sort method, like filter, can set or get the dataSource property.  The documentation only states that the sort method sets the property.

Thanks again!

0
Rosen
Telerik team
answered on 19 May 2016, 06:41 AM

Hello VAFIR,

Thanks for the suggestion. We will add such note to the documentation.

Regarding the sort method it seems OK to me. Maybe I'm missing something.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
VAFIR
Top achievements
Rank 1
answered on 19 May 2016, 07:21 PM
Naw, I was prolly looking at the sort property rather than the method.
Tags
Data Source
Asked by
VAFIR
Top achievements
Rank 1
Answers by
Rosen
Telerik team
VAFIR
Top achievements
Rank 1
Share this question
or