0

is it possible to export a paramQuery grid to pdf, or how can i do it? this is how i create the grid, i want to show this grid in a pdf file

createGrid = function(){
    var obj = { 
        width:"100%",
        height : "100%" , 
        title : "grid" , 
        flexHeight : false ,
        resizable : false ,
        draggable : false , 
        scrollModel: {scrollTillLastRow:false, scrollTillLastColumn:true},
        numberCell : true, 
    } ;
    obj.colModel = [
        { 
            title : "Date" , 
            width : 200 , 
            dataType : "string" , 
            dataIndx : "Date" 
        } ,
        { 
            title : "Name" , 
            width : 200, dataType : "string" , 
            dataIndx : "Name"
        } 
    ] ;
    obj.dataModel = {
        data : lstData //this is the object with the information
    } ;
    obj.width = "460px";
    obj.height = "300px";
    var $grid = $ ( "#grid_json" ).pqGrid ( obj ) ;
}
Valentin Lorentz
  • 9,556
  • 6
  • 47
  • 69

1 Answers1

0
{
            type: 'select',
            label: 'Format: ',
            attr: 'id="export_format" style= "padding: 5% 0"',
            options: [{
              xlsx: 'Excel',
              csv: 'Csv',
              htm: 'Html',
              json: 'Json',
              pdf: 'pdf'
            }]
          },

          {
            type: 'button',
            label: "Export",
            icon: 'ui-icon-arrowthickstop-1-s',
            listener: function () {

              var format = $("#export_format").val(),
                blob = this.exportData({                     
                  format: format,
                  render: true
                });
              if (typeof blob === "string") {
                blob = new Blob([blob]);
              }
              saveAs(blob, "Cost Modeler." + format);
            }
          }

you just have to include this code inside the toolbar Items

  • Don't just blurt out code! Adding some text to describe how this code best answers the question will preserve the long-term value of the answer and help to prevent the answer from being deleted during review. – NightOwl888 Apr 27 '18 at 10:21