Is there any way to print Igrid contents only in a page?
Regards,
Suresh A
Hi Suresh,
Can you specify what do you mean with igGrid Contents only? Do you want to print all the rows loaded on the page?
Thanks,
Yes i want to print all the rows in the grid. I have not enabled paging in my grid.
Hello Suresh A,
Well, this is CSS, so you can put it inline or you can reference it with link tag.
For example you can look at this sample:
http://samples.infragistics.com/jquery/grid/paging-api
In "CODE VIEW" section pick "PagingAPI.cshtml" and look at the source code. There you can see how to put CSS inline in the cshtml file or reference it with link tag.
Note: You don't have to modify the grid MVC code in order to print only the grid. You have to put class attribute on the elements which you don't want to print.
Hope this helps,
Martin Pavlov
Infragistics, Inc.
Its not working. Kindly upload any sample working solution if you have any.
Print only the grid contents in a page and not any other elements.
You can find attached the example html page.
In the example you can see that there are header and footer sections with some text.
When you print the page, by selecting "File->Print…" from the browser menu you can see that header and footer sections are not printed.
I hope this is the case you're trying to accomplish.
Best Regards,
Martin Pavlov,
Hi Martin,
The page which you have attached still prints the header and footer.
See my issue is
1. Layout page (Master Page)
2. Page which inherits the layout page. (Ex UserInformation)
3. In the User Information page i have an igrid which displays user information also some other information on the page. Also the grid has both horizontal and vertical scroll bars.
4. User Information page has a print button. On click of print button i need to print Grid contents only.
With the way which you have suggested it will print the page if there are no scroll bars on the grid. It will just ignore the places where we have added the css class to the tags and will print the whole page.
You can verify the same by adding scrollbars to the grid and the try to print it out. It will just print the contents similar to what print screen does.
Kindly provide a solution for the issue which i have reported.
Any updates on this???
Regards,.
Here is sample handler of click event which you will eventually use:
$('#exportButton').click(function (){ $('<table id="resultTable"></table>').appendTo($('.divContainer')); var rows = $('#grid2').igGrid('allRows'); rows.each(function(index, element) { var rowData = $(this).clone(); var currentRow = '<tr>' + $(rowData ).html() + '</tr>'; $(currentRow ).appendTo($('#resultTable')); }); var printWin = window.open("", "Printable", " location=no, toolbar=no, titlebar=no, resizable=no, status=no, menubar=no"); printWin.document.open(); printWin.document.write('<table>' + $('.divContainer').html() + '</tr>'); printWin.print(); printWin.close(); });
One you have the data you can clear the divContainer contents which are cloned from the grid data.
Hope that helps,