We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Modify headers in ejReportViewer

Thread ID:





120942 Oct 28,2015 08:51 PM UTC Oct 29,2015 10:48 AM UTC JavaScript 1
Tags: ejReportViewer
Jon Christensen
Asked On October 28, 2015 08:51 PM UTC

I followed this thread to modify the headers in ejReportViewer:  https://www.syncfusion.com/forums/119064/can-ejreportviewers-post-header-be-modified.   The PostReportAction worked fine the first time but the second time it failed on the second line, proxy.data is undefined:

            var proxy = $('#viewer')
            var proxyData = proxy.data('ejReportViewer');

If I remove my required header from the API and not override the doAjaxPost the report works fine and calls PostReportAction 6 times total.  I've got the doAjaxPost within an angular controller if that matters.

Here is my code:

        <div style="height: 650px;width: 950px;min-height:404px;" id="viewer"></div>
        <script type="text/javascript">

        $(function () {
                reportServiceUrl: "http://flexadmin.local-aon.com/api/Flex/APIReports",
                processingMode: ej.ReportViewer.ProcessingMode.Remote,
                reportLoaded: "onReportLoaded"


ej.ReportViewer.prototype.doAjaxPost = function (type, url, jsondata, onSuccess) {
            var proxy = $('#viewer')
            var proxyData = proxy.data('ejReportViewer');
            var inVokemethod = onSuccess;
                type: type,
                url: url,
                crossDomain: true,
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                data: jsondata,
                beforeSend: function (req) {
                    if (inVokemethod == "_getPageModel" || inVokemethod == "_getPreviewModel") {
                        if (!proxyData._isToolbarClick) {
                        } else {
                    req.setRequestHeader('ejAuthenticationToken', proxyData._authenticationToken);
                    req.setRequestHeader('__RequestVerificationToken', vToken);
                success: function (data) {
                    if (data && typeof (data.Data) != "undefined") {
                        data = data.Data;
                    if (typeof (data) == "string") {
                        if (data.indexOf("Sf_Exception") != -1) {
                            proxyData._renderExcpetion(inVokemethod + ":" + data);

Soundara Rajan S [Syncfusion]
Replied On October 29, 2015 10:48 AM UTC

Hi Jon,

Thanks for contacting Syncfusion support.

We are unable to reproduce the mentioned issue at our end and its working fine. The mentioned issue might have occurred due to accessing of DOM element (var proxy = $('#viewer')) before loading viewer tag in your application. So, please ensure the tag access after DOM element loaded completion. However, we have prepared a angular sample with AJAX override that can be downloaded from the below location,

Soundara Rajan S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon