Invalid .query() from odata-v4 dataSource

5 posts, 1 answers
  1. VAFIR
    VAFIR avatar
    3 posts
    Member since:
    Apr 2015

    Posted 16 May Link to this post

    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!

     

     

  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 18 May Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. VAFIR
    VAFIR avatar
    3 posts
    Member since:
    Apr 2015

    Posted 18 May in reply to Rosen Link to this post

    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!

  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 19 May Link to this post

    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!
     
  6. VAFIR
    VAFIR avatar
    3 posts
    Member since:
    Apr 2015

    Posted 19 May in reply to Rosen Link to this post

    Naw, I was prolly looking at the sort property rather than the method.
Back to Top
Kendo UI is VS 2017 Ready