Ticket T347511
Visible to All Users

How to export to excel in devextreme grid on custom button click ?

created 9 years ago

Hi ,

I am trying to export to excel functionality on devextreme grid.  I want to export records on not inbuilt functiolity button , I want to export on my custom button.

Since this is new upgrade for devextreme I cant see any code snippest to achive the same.

Please suggest

Answers approved by DevExpress Support

created 9 years ago

Hello EvilDestroyer,
You can disable the export and use the exportToExcel method for this purpose; e.g.:

JavaScript
var grid = $("#gridContainer").dxDataGrid({ dataSource: employees, "export": { enabled: false, fileName: "Employees", allowExportSelectedData: true } }).dxDataGrid('instance'); grid.exportToExcel(true);

See also: Working with Widgets

    Comments (2)

      Can you please tell me how to call this thing from my custom  button.

      I am using knockout js approach

      Alex Skorkin (DevExpress) 9 years ago

        I recommend that you refer to the Working with Widgets topic where this inquiry is described.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.