Hi,
I have a Grid that I change the data source read URL of dynamically, which works great for updating the data shown in the grid. The data source URL is always targeting a HTTP URI. I've attempted to add the Export to Excel functionality to this grid now, however clicking the export button always sends a HTTP request to the current page (with filter/sorting/etc query parameters) and not to the data source URI.
I have used a simple test grid with a local data source and exporting that works fine.
Can anyone shed some light on this please?
Cheers.
I have a Grid that I change the data source read URL of dynamically, which works great for updating the data shown in the grid. The data source URL is always targeting a HTTP URI. I've attempted to add the Export to Excel functionality to this grid now, however clicking the export button always sends a HTTP request to the current page (with filter/sorting/etc query parameters) and not to the data source URI.
I have used a simple test grid with a local data source and exporting that works fine.
Can anyone shed some light on this please?
Cheers.
4 Answers, 1 is accepted
0
Hello Greg,
This sounds as a known issue that we have fixed in the latest internal build. Could you download it and give it a try? If the internal build doesn't resolve the issue - could you provide some sample code that shows how you change the read URL?
Regards,
Atanas Korchev
Telerik
This sounds as a known issue that we have fixed in the latest internal build. Could you download it and give it a try? If the internal build doesn't resolve the issue - could you provide some sample code that shows how you change the read URL?
Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Greg
Top achievements
Rank 1
answered on 22 Dec 2014, 12:34 PM
Hi Atanas,
Thanks for the suggestion, unfortunately it does not seem like the internal build has solved this issue.
I am changing the read URL with the following method:
Whereby getEndpoint() returns the full URI based on some state parameters.
The grid is initially setup with the following configuration.
And refreshGrid() is called almost straight away after the grid is initialised. Given the interaction of 1. First page load and 2. Clicking export results in the following HTTP calls being made.
Regards
Thanks for the suggestion, unfortunately it does not seem like the internal build has solved this issue.
I am changing the read URL with the following method:
function refreshGrid() { $grid.data("kendoGrid").dataSource.transport.options.read.url = getEndpoint(); $grid.data("kendoGrid").dataSource.read();}Whereby getEndpoint() returns the full URI based on some state parameters.
The grid is initially setup with the following configuration.
dataSource: { type: "odata", transport: { read: { dataType: "json", }, }, schema: { data: function(data) { return data.Items; }, total: function(data) { return data.Count; } }, pageSize: 20, serverPaging: true, serverFiltering: true, serverSorting: true,},And refreshGrid() is called almost straight away after the grid is initialised. Given the interaction of 1. First page load and 2. Clicking export results in the following HTTP calls being made.
GET http://testdataservice.local/api/collection?inlinecount=allpages&%24top=20 200 OKGET http://localhost:31337/collection?%24inlinecount=allpages&%24top=21 200 OK Regards
0
Accepted
Hi,
The excel export creates a new data source using the options of the grid's data source. This is why it can't get the new url. I recommend one of the following:
1. Assign the new URL to dataSource.options.transport.read as well
2. Or specify the url option of the data source as a function:
Regards,
Atanas Korchev
Telerik
The excel export creates a new data source using the options of the grid's data source. This is why it can't get the new url. I recommend one of the following:
1. Assign the new URL to dataSource.options.transport.read as well
$grid.data("kendoGrid").dataSource.transport.options.read.url = getEndpoint();$grid.data("kendoGrid").dataSource.options.transport.read.url = getEndpoint();2. Or specify the url option of the data source as a function:
dataSource: { transport: { read: { url: getEndpoint } }}Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Greg
Top achievements
Rank 1
answered on 07 Jan 2015, 05:16 PM
Hi,
Happy new year!
Setting the options.transport.read.url worked fine. I was unaware of that options attribute, might have missed it in the documentation however.
Thank you for your help! :-)
Happy new year!
Setting the options.transport.read.url worked fine. I was unaware of that options attribute, might have missed it in the documentation however.
Thank you for your help! :-)