pdf generation from dwr json data - jqgrid

I call a method using dwr, where i l load a grid. That grid data must be generated in the form of a pdf.
LogsDataHandler.fetchEmailList(id1, id2, date1, date2,function(data){
}
the return data must be generated as a pdf. Any help ?

You should try to export jqgrid to excel built: http://www.trirand.net/documentation/php/_32h0wojvn.htm
stackoverflow answer:
JQGrid: Export Grid to PDF
examples:
http://www.trirand.com/blog/phpjqgrid/examples/export/pdf/default.php
http://www.trirand.com/blog/?page_id=393/help/export-to-excel-and-pdf/

Related

Kendo UI Grid Excel export issues

I'm trying to use the (relatively new) built-in Excel and PDF export features in Kendo UI grid, which seem pretty straightforward. The PDF downloads with all of the data, but the Excel file just has the column headers with no data.
Just trying for the most basic implementation of this at the moment; in the grid init block I have:
$("#accountsContactsGrid").kendoGrid({
toolbar: ["excel", "pdf"],
excel: {
fileName: "DonorsGridExport.xlsx",
filterable: true
},
pdf: {
fileName: "DonorsGridExport.pdf"
},
dataSource: { <snip rest of datasource code...> }
});
The grid shows fine in the browser as well as the PDF. It's just the Excel that is the exception, with no data showing.
I also tried pulling the buttons outside of the toolbar and using the saveAsExcel and saveAsPDF functions, and I get the same result (PDF works, Excel has no data).
Any ideas why the data would go missing just for the Excel export?

Select2 plugin with JQGRID

I am using Select2 plugin in JQgrid to auto complete the Drop down box.I used this example to work through.
Using bootstrap select2 with JqGrid form
I created a fiddle with the above example.
http://jsfiddle.net/VTL4x/3/
The data for the select2 is fed from JSON but I am not able to replicate it in JSfiddle so I have commented out the and used hard coded values.
The Json string is
[{"value":"Windows","id":"134"},
{"value":"Win2008","id":"135"},
{"value":"Win2003","id":"136"},
{"value":"AIX","id":"150"},
{"value":"Linux","id":"151"},
{"value":"Unknown","id":"152"},
{"value":"i5OS","id":"153"},
{"value":"z/OS","id":"154"},
{"value":"Solaris","id":"155"},
{"value":"Sun Ultra 80 ","id":"156"},
{"value":"VAX","id":"157"}]
The problem is When I try to edit the record it does NOT show the values for the fields that have Select2 dropdown box. but when you expend I could see that correct values highlighted in blue.
I tried to debug the demo that was provided but that also had the same problem.
I am fairly new to front-end programming can you please help.
Thanks for your help
Which version of select2 you're using? I'm using v4 so your data should look like this:
var mySelectData = [{"text":"Windows","id":"134"},
{"text":"Win2008","id":"135"},
{"text":"Win2003","id":"136"},
{"text":"AIX","id":"150"},
{"text":"Linux","id":"151"},
{"text":"Unknown","id":"152"},
{"text":"i5OS","id":"153"},
{"text":"z/OS","id":"154"},
{"text":"Solaris","id":"155"},
{"text":"Sun Ultra 80 ","id":"156"},
{"text":"VAX","id":"157"}];
Use text instead of value.

Getting UI form to render inside HTML table in GAS

In Google Sites, I am trying to add a short form consisting of a text box and a submit button as a cell in a row inside an html table. One copy of the form for each row in the table. I am trying to collect input data for each table row.
HTML File:
<html>
...
function showForm(){ // https://developers.google.com/apps-script/gui_builder#including
var app=UiApp.createApplication();
app.add(app.loadComponent("myGui"));
return app;
}
...
<table><tr><td><?=showForm()?></td></tr></table>
...
</html>
I then call the .html file from my doGet() function in my .gs file using HtmlService.createTemplateFromFile() method.
The table renders properly, except where I expect the form to appear, I instead get the text/string "UiApplication" instead of the text box + submit button combo.
Am I on the right track? Please help.
It's the wrong track.
You can't mix & match components from HtmlService and UiApp. GUI Builder is a packaged UiApp component.
Just stick with a FlexTable and fill the table cells with your builder component. But don't forget to set a prefix:
var flextab = app.createFlexTable();
for (row=0; ...)
for (col=0; ...)
flextab.setWidget(row, col, app.loadComponent("myGui", {"prefix": "row"+row+"col"+col});
BTW - you can only have one UiInstance in your web app. Call UiApp.createApplication() only once. If you need the UiInstance later on, you can always find it with UiApp.getActiveApplication().

Displaying table in PDF using ITextSharp and MVC 3

I am using ASP.NET MVC 3 environment. I am already able to view the PDF using iText5 for .NET. However, there are many columns in my original grid and I am just listing them in the PDF so a better approach would be to display it in a table.
I've constructed something like this in my controller which will populate my PdfPTable with the data I need:
Enroll.dTable = new PdfPTable(2);
Enroll.dTable.AddCell(itemType3.Name);
Enroll.dTable.AddCell(itemType3.Code);
However, I don't know how to display the PDFTable in my View. I tried something like this but it doesn't work:
#if (Model.dTable != null)
{
<chunk size ="10.0"> #Model.dTable</chunk>
}
Any help would be appreciated.
You can't do that this way. Produced PDF is a binary file and you need to flush it to the browser using "FileContentResult". So create the PDF file somewhere else out of your controller and then "return File" in your "FileContentResult" method in the controller.

Jqgrid issue with footer text format

In Jqgrid for some columns I have set as link.
And also for those columns I have set footer (MAX).
But the issue is, configured link is also getting added to the footer value, which is not expected.
Any help is appreciated.
Thanks in advance.
I think the problem is how you add the footer information. If you use footerData you can use false as the last parameter (the format parameter) of footerData. In the case the footer data will not be formatted by the standard formatter of the corresponding column. As the example see the demo.
If you add the data from the server using userdata and use userDataOnFooter jqGrid option the formatter parameter will be alway used as true (see the source code of jqGrid here and here). As a workaround you can remove userDataOnFooter:true setting and add the footer information manually with respect of footerData inside your localComplete event handle:
var myGrid = $("#list"); // your grid
// ...
// inside of localComplete you can add the data
var userData = myGrid.jqGrid("getGridParam","userData");
myGrid.jqGrid("footerData","set",userData,false);

Resources