Edit this page

How to pass culture via AJAX call from the HTML5 Report Viewer

Environment

Product Progress® Telerik® Reporting
Project Type Web Application
Viewer HTML5 Viewer

Description

How to pass the desired culture through an AJAX call from the HTML5 Report Viewer client to the server

Solution

The culture that is respected server side is taken from the deviceInfo["CurrentCulture"] property. If this property is not provided, the culture would be taken from the culture settings of the server. Currently, this property could be modified in the event jQuery.ajaxPrefilter that changes the options of the AJAX request before sending it. The culture is added only in the request for creating the document. The following code adds a handler for the jQuery.ajaxPrefilter event that sets the culture to the desired one. The PlaceCultureStringHere variable should be a string representing a valid culture.

$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
    var str = originalOptions.url;
    var documentsSuffix = "documents";
    var isDocumentsUrl = (str.indexOf(documentsSuffix) == str.length - documentsSuffix.length);

    if (isDocumentsUrl) {
        var d = JSON.parse(originalOptions.data);
        d.deviceInfo["CurrentCulture"] = PlaceCultureStringHere;
        options.data = JSON.stringify(d);
    }
});

The code should be placed in an HTML5 Report Viewer

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy