Author Topic: Show Loading on click of Export when data is huge  (Read 2148 times)

Lakshmi

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 10
    • View Profile
Show Loading on click of Export when data is huge
« on: May 03, 2018, 01:21:31 pm »
When the grid data is huge, on click of Export there is a significant delay before the file gets downloaded. I wish to show the loading message on click of Export. But $( ".selector" ).pqGrid( "showLoading" ); does not work.

Tried showing a separate loader gif on screen over pqgrid, but that also does not show up until the file gets downloaded. Also tried adding a separate click event handler, but pqgrid's internal handler takes precedence.

Tried using a setTimeout after showing my loader in the export listener. This did half the work - showed my loader image, but there were errors in pqgrid.js

Lakshmi

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Show Loading on click of Export when data is huge
« Reply #1 on: May 03, 2018, 01:25:48 pm »
pqgrid version: 3.3.5

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Show Loading on click of Export when data is huge
« Reply #2 on: May 03, 2018, 05:04:17 pm »
setTimeout works fine.

tested

Code: [Select]
                    listener: function () {
var grid = this;
grid.showLoading();
setTimeout(function(){
var format = $("#export_format").val(),                           
blob = grid.exportData({
//url: "/pro/demos/exportData",
format: format,                               
render: true
});
if(typeof blob === "string"){                           
blob = new Blob([blob]);
}
saveAs(blob, "pqGrid."+ format );
grid.hideLoading();
})
                    }

in this demo https://paramquery.com/pro/demos33/export_local