1

I have one jqxGrid , that I want to export. By default jqWidget uses it own server url instead of that I want to use my url.But for custom url export is not workking.

code

var url=window.location.href
$("#jqxgrid").jqxGrid('exportdata', 'xls','data',true,null,false,url);
sar
  • 1,277
  • 3
  • 21
  • 48

2 Answers2

0

The url should point to where the export file is hosted. Its definitely wrong to write window.location.href. If you don't have the export file, then you can export only through jQWidgets server.

scripto
  • 2,297
  • 1
  • 14
  • 13
  • But export file will be generated so that is why I have given same url – sar Dec 14 '15 at 11:30
  • the parameter is called serverURL so it should point to the export's PHP file, not to a file generated and based on your data – scripto Dec 14 '15 at 12:01
0

I fixed the problem by calling a function and getting the file through ajax call in that function, ajax call gets file from the location which I provide to it

$("#grid").jqxGrid('exportdata', 'csv', excelFileName, true, null, false, getPphFileForExport());

function definition is like below

getPphFileForExport: function() {
    $.ajax({
        url:"/jqWidgets/dataexport.php",
        success: function (data){
            return data;
        }
    });
}

please note that '/jqWidgets/dataexport.php' is the location in my repository that is accessible to this call

S_Jin
  • 31
  • 2