Tablecloth is lightweight, easy to use, unobtrusive way to add style and behavior to your html table elements. By simply adding 2 lines of code to your html page you will have styled and active tables that your visitors will love :)
It features:
- Adding even/odd class names to alternative rows.
- Adding over and out class names for mouse over and mouse out states.
- If set to true Tablecloth will highlight rows or columns (or both).
- If set to true Tablecloth adds selected state on click. Based on preferences it then selects rows or columns (or both). Unselect elements by clicking anywhere on the page.
- It leaves room for your upgrade. It has easily editable function that is called when you click on table cell that you can use for your own code.
Any comments you might have about Tablecloth you can post here.
Designer, developer and a passionate standardista. Long time web professional with huge experience in all types of front-end work. Founder of Css Globe and creator of
EmanuelBlagonic on 8 Oct, 2007 wrote:
I will try it on my future designs.
Nice job Alen, once again :)
cssglobe on 8 Oct, 2007 wrote:
pagerss reader on 8 Oct, 2007 wrote:
Same view in both browsers. I can suggest you to add some options on this good lock table
like sort in some order from header row. I can also search a script for this but you can do it better from me. I see a ready script for emulate ms excel.
Regards and good job
Good luck with version 2
cssglobe on 9 Oct, 2007 wrote:
Paul on 9 Oct, 2007 wrote:
Jason on 9 Oct, 2007 wrote:
cssglobe on 9 Oct, 2007 wrote:
MindStalker on 9 Oct, 2007 wrote:
cssglobe on 9 Oct, 2007 wrote:
Mickele on 9 Oct, 2007 wrote:
ps: sorry for my english
james on 9 Oct, 2007 wrote:
Stupid Developers on 9 Oct, 2007 wrote:
mike on 9 Oct, 2007 wrote:
Mike
james on 9 Oct, 2007 wrote:
Raul Riera on 9 Oct, 2007 wrote:
Sol Irvine on 9 Oct, 2007 wrote:
I tried to tweak the code to apply tablecloth only to a class, rather than all table tags, but I haven't been able to get it working. Is it possible?
Thanks!
James McDugal on 9 Oct, 2007 wrote:
cssglobe on 9 Oct, 2007 wrote:
Forrest Vodden on 9 Oct, 2007 wrote:
Otherwise, great work!
cssglobe on 9 Oct, 2007 wrote:
shane plasebo on 10 Oct, 2007 wrote:
Then I change in the HTML the id of the div container...
mike on 10 Oct, 2007 wrote:
daniel on 10 Oct, 2007 wrote:
Great work!
cssglobe on 10 Oct, 2007 wrote:
cssglobe on 10 Oct, 2007 wrote:
Darren Hoyt on 10 Oct, 2007 wrote:
Re: sorting, could you implement some of <a href="http://www.frequency-decoder.com/2006/09/16/unobtrusive-table-sort-script-revisited">the AJAX-y concepts found here</a>?
myheaditches on 10 Oct, 2007 wrote:
pagerss reader on 11 Oct, 2007 wrote:
1. Standard mathematical formulas for some mark cell more then 2 if value is int :)
2. Mark more than one cell like select several cells in different row and column.
3. third suggestions to make simple script :)
Good luck cssglobe
Marcelo on 11 Oct, 2007 wrote:
myheaditches on 11 Oct, 2007 wrote:
http://upsidedownturtle.com/tablecloth/tablecloth.js
Line 23 has the definable class, and there is now an if statement on line 42.
Tommy on 12 Oct, 2007 wrote:
rosenthal on 12 Oct, 2007 wrote:
Apple on 13 Oct, 2007 wrote:
saunameister on 14 Oct, 2007 wrote:
thanks for work
D on 16 Oct, 2007 wrote:
I'd like to use the script, except for the ActiveX problem.
Brad on 17 Oct, 2007 wrote:
[Wed Oct 17 08:21:30 2007] [error] [client 151.193.220.29] (8)Exec format error: exec of '/var/www/cgi-bin/tablecloth/tablecloth.css' failed, referer: http://xxxxxxxxx/cgi-bin/prod_env.cgi
[Wed Oct 17 08:21:30 2007] [error] [client 151.193.220.29] Premature end of script headers: tablecloth.css, referer: http://xxxxxxxxxx/cgi-bin/prod_env.cgi
[Wed Oct 17 08:21:30 2007] [error] [client 151.193.220.29] (8)Exec format error: exec of '/var/www/cgi-bin/tablecloth/tablecloth.js' failed, referer: http://xxxxxxx/prod_env.cgi
[Wed Oct 17 08:21:30 2007] [error] [client 151.193.220.29] Premature end of script headers: tablecloth.js, referer: http://xxxxxx/cgi-bin/prod_env.cgi
Any ideas?
Paul Irish on 19 Oct, 2007 wrote:
Looking forward to the update. :)
great script.
Nathan L on 21 Oct, 2007 wrote:
Leo on 22 Oct, 2007 wrote:
Thanks again
Leo
paul irish on 22 Oct, 2007 wrote:
Take a look at getActualCellIndex() from
http://www.javascripttoolbox.com/lib/table/source.php
Paul M on 23 Oct, 2007 wrote:
angel rodriguez leon on 24 Oct, 2007 wrote:
cssglobe on 25 Oct, 2007 wrote:
cssglobe on 25 Oct, 2007 wrote:
Lizzam on 30 Oct, 2007 wrote:
I'd like to suggest an on-the-fly edit data function, like those you can find in Google Spreadsheets, and I think this page would be of help
http://www.quirksmode.org/dom/cms.html
sam on 2 Nov, 2007 wrote:
Is there a forum for tablecloth? I have a few questions i would like to discuss.
Has anyone figure a way to limit table cloth to specific tables instead of all?
Stan on 13 Nov, 2007 wrote:
objectred on 20 Nov, 2007 wrote:
Can anybody tell me how to have a specific row pre-selected on page load, or how to use another element on the page to target a specific table row?
Thanks!
jas on 22 Nov, 2007 wrote:
junlisondra on 3 Jan, 2008 wrote:
Melanie on 23 Jan, 2008 wrote:
Great work and thank you once again =)
Matt on 4 Feb, 2008 wrote:
Just wondering if anyone has worked out how to limit the script to only work on the one table? The tablecloth.js file affects the scripting I have on another table on my site.
Thanks
Sam on 8 Feb, 2008 wrote:
I think that would be neat.
?? on 14 Feb, 2008 wrote:
Levic on 3 Mar, 2008 wrote:
It's a very nice script, but it's very slow on IE7 when the table have a lot of columns, but on Firefox or Safari, there is no pb, an idea ?
Bye
MAXMAS on 4 Mar, 2008 wrote:
I hope it will be modify and will not influence all forms on page.
Thanks a lot!!
Pneumatiky on 11 Mar, 2008 wrote:
Jon Egil on 19 Mar, 2008 wrote:
Predaj pneumatik on 22 Mar, 2008 wrote:
Petar on 2 Apr, 2008 wrote:
rockananda on 7 Apr, 2008 wrote:
Phill on 10 Apr, 2008 wrote:
Have one issue when adding and removing elements (table rows in my case), Tablecloth is not working correctly.
I am implementing something like the example here:
http://www.mredkj.com/tutorials/tableaddrow.html
but when I add a new row to the table the class comes up as undefined.
<td class="undefined">TEST DATA</td>
Any suggestions on how I could get the Tablecloth functionality to the user added row?
Thanks in advance and looking forward to future releases.
--Phill
Ezhilan on 15 Apr, 2008 wrote:
jonathan on 17 Apr, 2008 wrote:
I also agree that it would be great to be able to select multiple rows/columns and even sort.
Another good addition would be for it to be able to add the values in cells (e.g have a column which adds the values of the selected columns).
Jon on 21 May, 2008 wrote:
Bernike on 11 Jun, 2008 wrote:
I am experiencing a problem at the moment. Think it might be similar to Phill’s error on 10 April 2008. The tablecloth worked 100% until I had to add a couple of columns to my table and now it seems to go wonky. I am getting an “ojb has no properties” error. Any suggestions?
Bernike on 11 Jun, 2008 wrote:
fallentemplar on 4 Jul, 2008 wrote:
I do have a performance problem though, when I have more than 500 rows (im only selecting rows not cols), the script script slows to a CRAWL, as takes ~5 seconds on a quad core machine respond, FF and IE...
Anyway to solve this problem? I do see that you are doing linear redrawing....that's o(n)...but I suppose you can get it down to o(2) or even o(3) by keeping track of which rows a user selects..I could just completly rewrite the script..but the script already works, any help making it more efficent would be nice
Thanks!
fallentemplar on 4 Jul, 2008 wrote:
cannot paste onto page, wont submit, probaly wont handle the " or '....
email me if you want one.
online shopping on 5 Jul, 2008 wrote:
Charles on 21 Jul, 2008 wrote:
Beau Smith on 23 Jul, 2008 wrote:
I had one small issue which I'd like to submit as a patch. I wanted to style one row specifically using a class, but the Tablecloth javascript would replace the class with "even" or "odd". In the below patch, if there is an existing class, odd/even class is appended, otherwise just the odd/even class is added:
tablecloth.js - line 50
old: tr[i].className = css;
new: tr[i].className = tr[i].className ? tr[i].className + " " + css : css;
Autobazar Pocasie Spoje on 24 Jul, 2008 wrote:
oil painting reproductions on 25 Jul, 2008 wrote:
Erik on 25 Jul, 2008 wrote:
Work With 1 Class on 30 Jul, 2008 wrote:
Work with 1 id on 30 Jul, 2008 wrote:
agamemnus on 10 Aug, 2008 wrote:
And many thanks to Beau Smith for that additional class mod!
TANVE on 14 Aug, 2008 wrote:
Jonathan on 26 Aug, 2008 wrote:
Is there any way to get both to work on the same page?
njwebguy on 11 Oct, 2008 wrote:
Phill Pafford on 4 Nov, 2008 wrote:
I really enjoy the easy of use and would like to request some features if possible?
[LIST]
[* ] Sortable rows and columns
[* ] Drag and Drop
[* ] Alternate color schemes (Plug-in maybe)
[/LIST]
Thanks!!
s j s w e n g on 10 Nov, 2008 wrote:
Thanks,
S
dell on 19 Nov, 2008 wrote:
Not being too adept at coding, is there a way to specficy only a specific table that wold have data?
and how can I get around the issue for onload preload rollover images? Thanks for and pointers and direction on this.
dian on 1 Dec, 2008 wrote:
but, i'm having a trouble.. because, i need to add <th> under <th> and so on.. when i added it, it doesnt work.
can you help me, please?
Mikk on 3 Dec, 2008 wrote:
anyways great script xD !!!
IPFox on 18 Dec, 2008 wrote:
I'm a huge fan of tablecloth, but there is one thing I would like to achieve.
How could I apply tablecloth stuuf only to desired tables, not on all on the page? That is possibly simple css editing issue, but I'm not too comfortable with css.
caxton on 15 Jan, 2009 wrote:
I modified the example code as an schedule datagrid.
Here is the link: http://140.122.184.30/test/
However, there is a problem that the datagrid works fine on IE, but not on Firefox nor Chrome.
The left-side column should not be selected!
Any ideas?
Thanks.
webmaster tools on 16 Jan, 2009 wrote:
Thanks for the head start
jlhaslip on 7 Feb, 2009 wrote:
Saves a whole bunch of work.
Many thanks. Looking forward to seeing the next version.
Christopher Francis O'Donnell on 10 Feb, 2009 wrote:
Grozav Claudiu on 20 Mar, 2009 wrote:
Thanks
marcd on 31 Mar, 2009 wrote:
thanx in advance.
alberto marlboro on 2 Apr, 2009 wrote:
chitgoks on 27 Apr, 2009 wrote:
Amit Nazare on 30 Apr, 2009 wrote:
Andreas on 7 May, 2009 wrote:
What about the sorting-feature? It would be usefull.
regards
Philippe MARC on 7 May, 2009 wrote:
To people trying to highlight only one table (not all tables). I suggested that edit in the "start" function:
var tableover = false;
this.start = function(){
var tables = document.getElementsByTagName("table");
for (var i=0;i<tables.length;i++){
if(tables[i].className == 'tablecloth_on'){
tables[i].onmouseover = function(){tableover = true};
tables[i].onmouseout = function(){tableover = false};
rows(tables[i]);
}
};
};
Now only tables defined in HTML using "<table class=tablecloth_on>" will be affected.
Thanks again!
Philippe MARC on 7 May, 2009 wrote:
I used a script from Joost de Valk available here: http://yoast.com/articles/sortable-table/
The install = get js script, declare it in your page header. You're done!!!
If you use tablecloth only on some tables (see my previous post), trick is to change in function called "sortable_ini" keyword "sortable" to "tablecloth_on". You then have sort oprion on all tables using tablecloth.
Also, I got a bug in sortable table listing and got to change match to
if (thisTbl.className == 'tablecloth_on') {
instead of the fancy original match.
Thanks to Joost de Valk!
Katie on 29 May, 2009 wrote:
melksnor on 10 Jun, 2009 wrote:
$('table td').each(function(a){
$(this).mouseover(function(b){
$(this).add($(this).parent().children()).addClass('x');
x = a%$(this).parent().children().length;
$(this).parent().siblings().each(function(d){
$($(this).children().get(x)).addClass('x');
});
});
$(this).mouseout(function(b){
$(this).add($(this).parent().children()).removeClass('x');
$(this).parent().siblings().each(function(d){
$($(this).children().get(x)).removeClass('x');
});
});
});
Ahmad Alfy on 23 Jun, 2009 wrote:
That's a great plugin really and add a lot of usability to your website. My concern is developers with bad attitude. The guys who still build their websites with tables will be surprised if they tried to use this plugin :)
I did a minor modification to this script and used a function I wrote (getElementsByClass(class)) instead of using (getElementById) to apply the style to certain tables only.
Regards