)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to hide export menu in Dashboard Viewer using JavaScript API

Platform: Dashboard Platform |
Control: Dashboard SDK |
Published Date: February 14, 2018 |
Last Revised Date: May 7, 2019

Steps to hide the Export Excel option in the Dashboard Viewer

  1. Hide the Export Excel option in the dashboard menu:

To remove the Export Excel option in the Dashboard Viewer through the menu, use the beforeDashboardMenuOpen event as shown in the following code snippet:

$("#dashboard").ejDashboardViewer({
            Serviceurl:‘Service URL’,
            dashboardPath:‘Path of the Dashboard’,
            beforeDashboardMenuOpen: function (args) {     
                for (var i = 0; i < args.menuData.length; i++) {
                    if (args.menuData[i].id === 13) { //Where 13 denotes that Excel menu item 
                        args.menuData.splice(i, 1); // To remove the excel option alone from the menu
                        break;
                    }
                }
            }
        });

 

The following screenshot illustrates the result of the above code snippet:

A screenshot of a cell phone

Description generated with very high confidence

 

  1. Hide the Export Excel option in the context menu of the dashboard widget:

To remove anyone of the exporting options in the Context Menu, use the beforeContextMenuOpen event. Refer to the following code snippet to remove the Export Excel option from the Context Menu of a dashboard widget:

$("#dashboard").ejDashboardViewer({
     Serviceurl:‘Service URL’,
            dashboardPath:‘Path of the Dashboard’,
             beforeContextMenuOpen: function (args) {             
                for (var i = 0; i < args.menuData.length; i++) {
                    if (args.menuData[i].id === 14 && args.menuData[i].parentId === 11) { //Where 14 denotes the Excel menu and 11 denotes the Parent menu
                        args.menuData.splice(i, 1); // Remove the excel option
                        break;
                    }
                }
            }
        });
 

 

The following screenshot illustrates the result of the above code snippet:

Dashboard rendered based on the code changes

 

  1. Hide the Export Excel option in the dashboard widget menu:

To remove anyone of the exporting options in the dashboard widget menu, use the beforeControlMenuOpen event. Refer to the following code snippet to remove the Export Excel option from the dashboard widget menu:

$("#dashboard").ejDashboardViewer({
     Serviceurl:‘Service URL’,
            dashboardPath:‘Path of the Dashboard’,
                                  beforeControlMenuOpen: function (args) { 
            for (var i = 0; i < args.menuData.length; i++) { 
                if (args.menuData[i].id === 14 && args.menuData[i].parentId === 11)  //Where 14 denotes the Excel menu and 11 denotes the Parent menu                                                               
                   {
                     args.menuData.splice(i, 1); // Remove the excel option
                     break; 
                      } 
            } 
       }
});
 

 

The following screenshot illustrates the result of the above code snippet:

A screenshot of a cell phone

Description generated with very high confidence

  1. Hide the Export Excel option in the tab menu of the multi-tabbed dashboard:

To remove anyone of the exporting options in the tab menu of the multi-tabbed dashboard, use the beforeTabMenuCreate event. Refer to the following code snippet to remove the Export Excel option from the tab menu:

$("#dashboard").ejDashboardViewer({
     Serviceurl:‘Service URL’,
     dashboardPath:‘Path of the Dashboard’,
     beforeTabMenuCreate: function(args) { 
                for (var i = 0; i < args.menuData.length; i++) {
                    if (args.menuData[i].id === 3) { // Id 13 denotes export excel option
                        args.menuData.splice(i, 1); // Remove the excel option
                        break;
                    }
                }
            }
        });
 

 

The following screenshot illustrates the result of the above code snippet:

      

A screenshot of a cell phone

Description generated with very high confidence

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon