Author Topic: Add Loader While Loading FIle  (Read 376 times)

Punit

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Add Loader While Loading FIle
« on: July 06, 2022, 11:40:49 am »
Dear Team,
Is there any way to add a loader while loading the excel file? if we upload a large file then it takes some time so we want to add a loader while uploading an excel file.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Add Loader While Loading FIle
« Reply #1 on: July 06, 2022, 06:29:28 pm »
Loader can be shown by grid.showLoading(); and hidden by grid.hideLoading();

Code: [Select]
listener: function( evt ){
    //import xlsx or csv file via HTML5 file input control.
    var grid = this,
        file = evt.target.files[0];//doesn't work in IE9.
    if(file){
        grid.showLoading();
        //import first sheet of xlsx into workbook.
        pq.excel.importXl( {file: file}, function( wb ){
           
            grid = grid.Tab().main();//always import in main tab.
            //import workbook into grid.                           
            grid.importWb({workbook: wb, extraRows: 10, extraCols: 10});
            grid.hideLoading();
        })
    }