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

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

4 Answers 1440 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
AsA
Top achievements
Rank 1
AsA asked on 04 Nov 2015, 10:27 PM
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

 

4 Answers, 1 is accepted

Sort by
0
AsA
Top achievements
Rank 1
answered on 05 Nov 2015, 08:41 AM

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?

 

 


 
 
 
0
Kiril Nikolov
Telerik team
answered on 06 Nov 2015, 11:34 AM

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!
 
0
AsA
Top achievements
Rank 1
answered on 06 Nov 2015, 11:36 PM
Thank you very much for your help.
0
Kiril Nikolov
Telerik team
answered on 10 Nov 2015, 08:48 AM

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!
 
Tags
Data Source
Asked by
AsA
Top achievements
Rank 1
Answers by
AsA
Top achievements
Rank 1
Kiril Nikolov
Telerik team
Share this question
or