Changing the Available Connections in the SqlDataSource Wizard of the Web Report Designer
Environment
Product | Progress® Telerik® Reporting |
Project Type | Web Application |
Description
I want to dynamically change the dropdown with the existing connections in the first step of the SqlDataSource wizard in the Web Report Designer.
By default, the connections dropdown is populated based on the configuration file of the applicatino where the service of the Web Report Designer is running and also by the ReportDesignerServiceConfiguration.SettingsStorage property.
I would like to be able to dynamically filter those connections, for example, based on the currently logged in user.
Suggested Workarounds
Currently, the GetDataConnections method used to populate the dropdown is not virtual, thus as a workaround, we may instead override the Fetch API where we may intercept the response of that request and have its JSON modified.
For example:
const originalFetch = window.fetch;
window.fetch = async (...args) => {
let [resource, config] = args;
let response = await originalFetch(resource, config);
if (resource === "api/reportdesigner/dataconnections") {
// response interceptor
let json = () =>
response
.clone()
.json()
.then((data) => {
data.shift();
return data;
});
response.json = json;
}
return response;
}
The above example simply removes the first element of the array of connections returned by the GetDataConnections endpoint but the approach allows for more complex logic being used for filtering the array.
The URL of the
GetDataConnections
request may differ depending on what base route has been provided in theRoute
attribute of theReportDesignerController
.