Error in exporting pdf in JQgrid

455 views Asked by At

I want to export the details in form of pdf file.Pdf are downloaded but only headers means product,quantity,price ,total only missing the body of the content means product details.

$("#list_records_view").jqGrid({
                url: "view.php?name="+sample,
                datatype: "json",
                mtype: "GET",
                colNames: ["Product", "Price", "Qty", "Total", "Date"],
                colModel: [ 

                    { name: "product" },
                    { name: "price" },
                    { name: "qty" },
                    { name: "total" },
                    { name: "date" }


                ],
                pager: "#perpageview",
                rowNum: 10,
                rowList: [10,20],
                sortname: "id",
                sortorder: "asc",
                height: 200,
                width: 780,
                viewrecords: true,
                //loadonce: true, 
                gridview: true,
               //editurl: "clientArray",
                caption: ""

            }); 
            $("#export").on("click", function(){
                    $("#list_records_view").jqGrid("exportToPdf",{
                        title: 'Customer Report',
                        orientation: 'portrait',
                        pageSize: 'A4',
                        description: 'Purchase Report',
                        customSettings: null,
                        download: 'download',
                        includeLabels : true,
                        includeGroupHeader : true,
                        includeFooter: true,
                        fileName : "jqGridExport.pdf"
                    })
                });
1

There are 1 answers

1
Tony Tomov On BEST ANSWER

Exporting to PDF, CSV, Excel is possible only with datatype set to local or with loadonce parameter set to true.

In order to make the export possible you need to uncomment loadonce : true and make it active.

More on exporting features can be read here: