How to set the dataSource.transport.read at run time and not execute dataSource.transport.read on request but not on page load?

5 posts, 0 answers
  1. AsA
    AsA avatar
    3 posts
    Member since:
    Aug 2015

    Posted 04 Nov 2015 Link to this post

    Problem:
     
    A kendo UI "window" widget that contains a "grid" widget.
     
    The "window" is a popup window, it is hidden on initial page load.
     
    The "window" and the "grid" are initialized using Markup ( data-role="window", data-role="grid" and bind, no JavaScript configuration, only for events)
     
    A button "Open Window" opens the popup window that has inside a grid.
     
    Every time the popup window is opened a new Ajax call must be done for reloading the grid (through: $("#grid").data("kendoGrid").dataSource.read();)
     
    Questions:
     
    1. How can be avoided to load data the first time?
    Note - I do not bind the grid but as the grid nested into the window (container), when that (the window) is bound, the grid is then bound as well
    (is there a way to avoid this behaviour?
    It could be done defining the grid outside the window and "attach" it at runtime but I would keep the HTML consistent).
     
    2. Is there a way to not raise the dataBound.transport.read the first time (on page loading / binding)?
     
    3. I tried to set an empty url (for avoiding the Ajax call on page loading) and then change it at every open popup ($("#grid").data("kendoGrid").dataSource.options.transport.read.url = url;) but it doesn't work, the url doesn't change.

     

    Thank you for help

     
  2. AsA
    AsA avatar
    3 posts
    Member since:
    Aug 2015

    Posted 05 Nov 2015 Link to this post

    I apologize, wrong title.

    The correct one:

    How to set the dataSource.transport.read at run time and execute dataSource.transport.read on request but not on page load?

     

     


     
     
     
  3. Kendo UI is VS 2017 Ready
  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 06 Nov 2015 Link to this post

    Hello AsA,

     

     

    Straight to your questions:

     

    1. You can set autoBind to false, so no data is fetched until dataSource.read() method is used. It is explained here:

     

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-autoBind

     

    2. Same as above

     

    3. You can use setOptions to change any of the Grid defined options, here is the relevant documentation piece:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-setOptions

     

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. AsA
    AsA avatar
    3 posts
    Member since:
    Aug 2015

    Posted 06 Nov 2015 Link to this post

    Thank you very much for your help.
  6. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 10 Nov 2015 Link to this post

    Hello AsA,

     

    Happy to help.

     

    In case you have any further questions, please do not hesitate to contact us.

     

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready