Controlling the datasource read

3 posts, 1 answers
  1. Sune
    Sune avatar
    14 posts
    Member since:
    Aug 2015

    Posted 08 Oct 2015 Link to this post

    Hi

    We are programatically configuring an odata datasource. We setup filters, group and sort and columns.

    The datasource appears to be issueing two reads during this process.

     

    The code is something like:

    ds.filter(filter);

    ds.group(group);

    ds.sort(sort);

    At no point are we explicitly calling ds.read() but the above statements trigger 2 consecutive reads, the first of which is triggered on the ds.filter(filter) and serves no purpose at all. 

    We would like to prevent the reads until the datasource has been fully configured.

    Is this possible to disable the first read and control reads explicitly?

     

    Thanks, 

    Sune

  2. Answer
    Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 12 Oct 2015 Link to this post

    Hello Sune,

    This behavior is expected when using server operations, as each change in the sorting, filtering and etc options should lead to a Read request in order to keep the DataSource updated. In this case I  would suggest using the query method instead, as it allows you to set all those options at the same time, avoiding unnecessary requests.

    Regards,
    Alexander Popov
    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. Sune
    Sune avatar
    14 posts
    Member since:
    Aug 2015

    Posted 12 Oct 2015 in reply to Alexander Popov Link to this post

    Hi Thanks! This solved it nicely. 

    I tried several hacks, replacing the read() with a bogus do-nothing method - didn't work. Then I tried reinitializing the datasource from scratch with the correct config from the start.

    The last idea may actually be a good solution also but in my case it's a bigger rewrite.

Back to Top