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.
EmanuelBlagonic 8 Oct, 2007
I will try it on my future designs.
Nice job Alen, once again :)
cssglobe 8 Oct, 2007
pagerss reader 8 Oct, 2007
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 9 Oct, 2007
Paul 9 Oct, 2007
Jason 9 Oct, 2007
cssglobe 9 Oct, 2007
MindStalker 9 Oct, 2007
cssglobe 9 Oct, 2007
Mickele 9 Oct, 2007
ps: sorry for my english
james 9 Oct, 2007
Stupid Developers 9 Oct, 2007
mike 9 Oct, 2007
Mike
james 9 Oct, 2007
Raul Riera 9 Oct, 2007
Sol Irvine 9 Oct, 2007
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 9 Oct, 2007
cssglobe 9 Oct, 2007
Forrest Vodden 9 Oct, 2007
Otherwise, great work!
cssglobe 9 Oct, 2007
shane plasebo 10 Oct, 2007
Then I change in the HTML the id of the div container...
mike 10 Oct, 2007
daniel 10 Oct, 2007
Great work!
cssglobe 10 Oct, 2007
cssglobe 10 Oct, 2007
Darren Hoyt 10 Oct, 2007
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 10 Oct, 2007
pagerss reader 11 Oct, 2007
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 11 Oct, 2007
myheaditches 11 Oct, 2007
http://upsidedownturtle.com/tablecloth/tablecloth.js
Line 23 has the definable class, and there is now an if statement on line 42.
Tommy 12 Oct, 2007
rosenthal 12 Oct, 2007
Apple 13 Oct, 2007
saunameister 14 Oct, 2007
thanks for work
D 16 Oct, 2007
I'd like to use the script, except for the ActiveX problem.
Brad 17 Oct, 2007
[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 19 Oct, 2007
Looking forward to the update. :)
great script.
Nathan L 21 Oct, 2007
Leo 22 Oct, 2007
Thanks again
Leo
paul irish 22 Oct, 2007
Take a look at getActualCellIndex() from
http://www.javascripttoolbox.com/lib/table/source.php
Paul M 23 Oct, 2007
angel rodriguez leon 24 Oct, 2007
cssglobe 25 Oct, 2007
cssglobe 25 Oct, 2007
Lizzam 30 Oct, 2007
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 2 Nov, 2007
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 13 Nov, 2007
objectred 20 Nov, 2007
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 22 Nov, 2007
junlisondra 3 Jan, 2008
Melanie 23 Jan, 2008
Great work and thank you once again =)
Matt 4 Feb, 2008
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 8 Feb, 2008
I think that would be neat.
?? 14 Feb, 2008
Levic 3 Mar, 2008
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 4 Mar, 2008
I hope it will be modify and will not influence all forms on page.
Thanks a lot!!
Pneumatiky 11 Mar, 2008
Jon Egil 19 Mar, 2008
Predaj pneumatik 22 Mar, 2008
Petar 2 Apr, 2008
rockananda 7 Apr, 2008
Phill 10 Apr, 2008
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 15 Apr, 2008
jonathan 17 Apr, 2008
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 21 May, 2008
Bernike 11 Jun, 2008
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 11 Jun, 2008
fallentemplar 4 Jul, 2008
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 4 Jul, 2008
cannot paste onto page, wont submit, probaly wont handle the " or '....
email me if you want one.
online shopping 5 Jul, 2008
Charles 21 Jul, 2008
Beau Smith 23 Jul, 2008
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 24 Jul, 2008
oil painting reproductions 25 Jul, 2008
Erik 25 Jul, 2008
Work With 1 Class 30 Jul, 2008
Work with 1 id 30 Jul, 2008
agamemnus 10 Aug, 2008
And many thanks to Beau Smith for that additional class mod!
TANVE 14 Aug, 2008
Jonathan 26 Aug, 2008
Is there any way to get both to work on the same page?
njwebguy 11 Oct, 2008
Phill Pafford 4 Nov, 2008
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 10 Nov, 2008
Thanks,
S
dell 19 Nov, 2008
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 1 Dec, 2008
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 3 Dec, 2008
anyways great script xD !!!
IPFox 18 Dec, 2008
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 15 Jan, 2009
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 16 Jan, 2009
Thanks for the head start
jlhaslip 7 Feb, 2009
Saves a whole bunch of work.
Many thanks. Looking forward to seeing the next version.
Christopher Francis O'Donnell 10 Feb, 2009
Grozav Claudiu 20 Mar, 2009
Thanks
marcd 31 Mar, 2009
thanx in advance.
alberto marlboro 2 Apr, 2009
chitgoks 27 Apr, 2009
Amit Nazare 30 Apr, 2009
Andreas 7 May, 2009
What about the sorting-feature? It would be usefull.
regards
Philippe MARC 7 May, 2009
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 7 May, 2009
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 29 May, 2009
melksnor 10 Jun, 2009
$('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 23 Jun, 2009
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