How to fix 'remove html content from formater in PDF export' jq Grid issue?

230 views Asked by At

I have jq Grid table with export options.
Created a custom button to Export to PDF inside of JQGrid, here is a bit of the code:

JQ-grid code :

 $("#list1").jqGrid({  datatype: "xml", colModel:[{name:'success',index:'SCOUNT', width:90,sortable:true,formatter:function(cellvalue, options, rowObject) {
                    if(cellvalue!=0)
                         var html ='<span sugar="sugar0b" style="cursor:pointer;" onClick="showSuccessDetails('+options.rowId+');return false;"><u>'+cellvalue+'</u></span>';
                        else
                         var html ='<span sugar="sugar0b" style="cursor:pointer;">'+cellvalue+'</span>';
                         return html

                        }},
                {name:'failure',index:'FCOUNT', width:90,sortable:true,formatter:function(cellvalue, options, rowObject) {
                    if(cellvalue!=0)
                     var html ='<span sugar="sugar0b" style="cursor:pointer;" onClick="showFailureDetails('+options.rowId+');return false;"><u>'+cellvalue+'</u></span>';
                    else
                     var html ='<span sugar="sugar0b" style="cursor:pointer;">'+cellvalue+'</span>';
                     return html

                    }}]

Export Button Code: `

$("#exportPDF").click(function(){
                $("#list1").jqGrid("exportToPdf",{
                    /* title: 'jqGrid Export to PDF', */
                    orientation: 'portrait',
                    pageSize: 'A4',
                    customSettings: null,
                    download: 'download',
                    includeLabels : true,
                    includeGroupHeader : true,
                    includeFooter: true,
                    fileName : "CDR_Report.pdf"
                })
            });

The problem is on click of Export button it will export table as PDF in that for Success column and Failure column showing formatter html code also.
How to remove Html code for exporting only Needed cellValue in pdf.

Kindly check sample Image: Linkenter image description here

0

There are 0 answers