Ask for a solution to bugs, press search 2 times and then click download file. and get multiple files

Tags: #<Tag:0x00007f8b266051b8> #<Tag:0x00007f8b26604cb8>

I press search 2 times, it’s Ajax and the data is fetched into handsontable, press download Excel file already got many files.
Every time I press search without refreshing the page Then click download Excel file, you will get the same number of files that I clicked on

Hi @overload2011

Can you please provide additional information on your implementation? Handsontable doesn’t support exporting files to Excel, do you have a custom plugin for that functionality? If you could share your code (preferably in a chosen sandbox) it would be easier to understand the issue.

This Code :

$.ajax({
            url: "xxx",
            type: "GET",
            data: $("#Rm_Purchasing_Item").serialize(),
            dataType: "json",
            success: function(data) {
                if (data.data.length > 0) {
                    var objectData = data.data;
                    var $container = $("#Table_Rm_Purchasing_Item");
                    $container.handsontable({
                        data: objectData,
                        colHeaders: data.col,
                        height: 600,
                        filters: true,
                        hiddenColumns: {
                            columns: [0],
                        },
                        autoRowSize: true,
                        viewportColumnRenderingOffset: 100,
                        dropdownMenu: true,
                        rowHeaders: true,
                        fixedColumnsLeft: 5,
                        className: "htCenter",
                        manualColumnMove: true,
                        licenseKey: "non-commercial-and-evaluation"
                    });

                    var hotInstance = $("#Table_Rm_Purchasing_Item").handsontable('getInstance');
                    $('body').on('click', '.Excel', function() {
                        var $container = $("#Table_Rm_Purchasing_Item");
                        console.log('data of ', $container.handsontable('getData'));

                    });
                }
            },
        })

When I click Search for the first time, Console will show information 1 time.
But when I click Search 1 more time, the data shows 2 consoles per 1 click.
and click search 2 more time , data shows 3 consoles per 1 click

Hi @overload2011

From the code you sent I can see that you are creating a Handsontable instance through AJAX. However, I still don’t know what you mean by clicking search and what is your implementation of exporting to Excel. Can you please explain it more?

I want to export data in handsontable to excel format.

OK, I see. So, as I mentioned, currently it is not possible to do that with our API. In the past our users proposed custom implementation of this functionality. You can find one of the examples here:

That might be useful for your to build your own implementation.