Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
printing support
02/09/2008
07:35
Avatar
drlinux
Member
Members
Forum Posts: 25
Member Since:
26/08/2008
sp_UserOfflineSmall Offline

new version pls add the printing support for records, many thanks.

regards,

ibrahim.

03/09/2008
04:32
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

I think that this is a "little" difficult. Printing from html is a not trivial task.

You can construct you own printing function. You have all the needed

data and can construct what you want.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

11/02/2009
16:35
Avatar
glemarie
France
Member
Members
Forum Posts: 66
Member Since:
19/12/2008
sp_UserOfflineSmall Offline

Hi,

I needed this functionality too. What I did is that I added a "print" button in the toolbar.

Then with jQuery, I clone jqGrid table in a new window (a bit dirty to find the table, but It works, even if you have multiple tables on your page) :

// Parent container of the "list" DIV (In my case, I have a DIV includind all elements of a jqGrid table)
var idMasterDiv = $('#'+gridName).parent().parent().attr('id');

// Find jqGrid table to print
$('div[id^="jqgh"]').each ( function() {
    var idParentDiv = $(this).parent().parent().parent().parent().parent().parent().attr('id');
   
    if (idParentDiv == idMasterDiv && objetEntete==false) {
        objetEntete = $(this).parent().parent().parent(); //  THEAD of the header row (title of the fields)
    }
});

// Create a hidden div which will contain the data to be printed
$('<div>').attr('id', 'printDiv').css('display', 'none').appendTo('body');
// Add css to custom the printed document
$('<link rel="stylesheet" href="css/general.css" media="all" type="text/css"/>').appendTo('#printDiv');
$('<link rel="stylesheet" href="css/print.css" media="all" type="text/css"/>').appendTo('#printDiv');
$('<table>').attr('id', 't_printDiv').appendTo('#printDiv');
// Clone jqGrid table header
$('<caption>'+titrePage+'</caption>').appendTo('#t_printDiv');
objetEntete.clone().appendTo('#t_printDiv');
// Clone jqGrid data
$('#'+gridName+' tbody:first').clone().appendTo('#t_printDiv');
$('</table>').appendTo('#printDiv');

// Open a new window
var WindowObject = window.open('', "TrackHistoryData",
                              "width=900,height=400,top=200,left=150,toolbars=yes,scrollbars=yes,status=no,resizable=no");
// Send the DIV to be printed in the window
WindowObject.document.writeln($('#printDiv').attr('innerHTML'));
// Clean the current document
$('#printDiv').remove();
WindowObject.document.close();
// Print the table
WindowObject.focus();
WindowObject.print();
WindowObject.close();
}

If anybody have a more simple way of finding the corect <thead> & <tbody> elements to print, I'll be glad !

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
43 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information