473,811 Members | 3,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

printing out a data table as it currently appears

Hi,

I have a data table on my page (buried amidst other images and
extraneous text). I would like to spawn a new window that
automatically prints the content of my data table, and only that
content. The tricky part is the ordering of the table may not be the
same as when the page was loaded. I recently discovered the virtues
of JQuery and its tablesorter plugin (http://motherrussia.polyester.se/
jquery-plugins/tablesorter/), so it is possible my user will sort the
table rows to his satisfaction before printing.

Your help is greatly appreciated, - Dave

Feb 9 '07 #1
1 3484
la***********@z ipmail.com wrote:
Hi,

I have a data table on my page (buried amidst other images and
extraneous text). I would like to spawn a new window that
automatically prints the content of my data table, and only that
content. The tricky part is the ordering of the table may not be the
same as when the page was loaded. I recently discovered the virtues
of JQuery and its tablesorter plugin (http://motherrussia.polyester.se/
jquery-plugins/tablesorter/), so it is possible my user will sort the
table rows to his satisfaction before printing.

Your help is greatly appreciated, - Dave
Have you tried making a clone of the table and putting it into the new
window?

A quick example is below, feature detection etc. has been omitted for
brevity. I'm not sure all browsers will let you move DOM elements
across windows, though I think any that support jQuery will.

If not, wrap the table in a DIV, grab its innerHTML and write that to
the popup (make sure you write the *entire* table if using this method).
You will probably need to add elements for style and script support if
you want the popup to behave like the parent.

<script type="text/javascript">

function popWin () {
var w = window.open('', 'tableWindow',' ');
w.document.writ e('<title>Data table</title><body></body>');
w.document.clos e();
return w;
}

function popTable(id){
var tableWin = popWin();

// Clone the table and add it to the popup
var table = document.getEle mentById(id).cl oneNode(true);
tableWin.docume nt.body.appendC hild(table);
}

</script>
<table id="x"><tr><td> foo<td>bar</table>
<button onclick="popTab le('x');">Show table in new window</button>
--
Rob
Feb 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3026
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation of the printing, I arranged the graphic elements on the page the way it should be. When I got to printing text, it went across the page, not down as I need it to go. I tried to use the hDC.SetWorldTransform(0, -1, 1, 0, 0, 0) command to rotate...
0
1793
by: Gerald Thallinger | last post by:
Hallo together! I try so solve the following problem. I wrote a HTML-File an print it via MS Internet Explorer, Version 6.0. I currently have all 3 tables in my report for outputting. I print the header table. I print the body table with, 1 to 100 rows from the database. Then I print the footer. Currently I put a height on the body table so the footer table will be near the bottom of the page each time.
6
482
by: Bill | last post by:
Hi I am trying to get my listbox items to print if they stream past the one page mark. my code is working for one page of information (if the e.hasmorepages) is not there. But I am having trouble getting it to print on multiple pages. The second page will not print at all. Thanks in advance
1
1649
by: Smitha Nataraj | last post by:
Hello, Please let me know if you have the solution for a similar kind of problem... Background: I have an aspx page which is used as a report i.e. will be used for printing some information. The page has some text fields, some bulleted lists, 4 tables, a diagram. All the data is variable based on some parameters. Hence the height of the text fields, height of the table nor the height of the image is known.
6
4093
by: Siv | last post by:
Hi, I am getting into printing with VB.NET 2005 and want to implement the usual capability that a user can select a selection of pages. I have a report that is generated by my application that if the user wants all pages will produce 3 pages. I want to offer the user the ability to select via the print dialog that only pages 1 and 2 of it are printed or possibly pages 1 and 3 but not 2. At the moment I can produce all three pages...
2
6410
by: sitemap | last post by:
Hello guys, I have a big problem with printing of windows.Forms :( I have application with "print" button. I am trying to use "e.Graphics.CopyFromScreen"... but in final result, over the printing form appears other controls from the existing or new applications in the screen ( Printing.. Please wait... - form for example). I mean that "CopyFromScreen" getting all the forms in defined coordinates and does not matter that the form that...
1
1605
by: Parasyke | last post by:
Thanks for any help.. I currently have a database with about 100 products with picture links in an external folder. I have a form from which I can successfully display a product, its specifications, and print a sheet with the picture and the relative data. I'm trying to write some code to allow me to bring up the products and add them to a batch of about 20 different product sheets to print at one time, rather than the user having to hit...
2
9987
by: Brad Pears | last post by:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default printer settings to print. I wanted the print preview to appear the same for all users (i.e. a default page size of 8.5x14 (legal) and portrait mode). Many users have different printers as their default (plotters etc..) and I found that various...
7
2428
by: johnacooke | last post by:
The W3C added THEAD, TFOOT and TBODY elements to facilitate the printing of long tables, so that header and footer information could be repeated on each page. While I have seen this discussed briefly in a number of text books, I have never seen it applied in reality satisfactorily. Can anyone point me to a real situation where this has been done please? I have tried in vain to find examples, but have been deluged with irrelevant...
0
9726
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10384
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10130
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5553
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4338
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.