473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 3464
la***********@zipmail.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.write('<title>Data table</title><body></body>');
w.document.close();
return w;
}

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

// Clone the table and add it to the popup
var table = document.getElementById(id).cloneNode(true);
tableWin.document.body.appendChild(table);
}

</script>
<table id="x"><tr><td>foo<td>bar</table>
<button onclick="popTable('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
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...
0
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...
6
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...
1
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....
6
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...
2
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...
1
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...
2
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...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.