tel8618217223380 / dwpe

Automatically exported from code.google.com/p/dwpe
MIT License
0 stars 0 forks source link

Add the ability to auto-hide the table #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want to have the chart on my page, but not the table.  What i do now is
to add "style='display:none;'" to the <thead> and <tbody> elements of my
table (I want to keep the <caption>>.  It would be nice if the plugin could
do this automatically.

Original issue reported on code.google.com by afme...@gmail.com on 9 Apr 2010 at 4:00

GoogleCodeExporter commented 9 years ago
Thanks for the feedback. 
We wouldn't recommend using display: none to hide these elements, as it will 
make them inaccessible to users 
on screen readers (which defeats the purpose of this plugin). 

If you use JavaScript to add a class of "accessHide" to the table after 
creating your chart, it will accessibly hide 
the whole table. If you want to keep a subset of the table on the page, we'd 
recommend adjusting the css for 
this class to only hide certain portions of the table using absolute 
positioning (not display). 

I'm not sure how well it'll work across browsers, but try something like...

table.accessHide { position: static; }
table.accessHide tbody, table.accessHide thead { position: absolute; left: 
-999999px; }

If that doesn't work, you might consider using jQuery to grab the text from the 
caption and insert it before the 
hidden table...
myTable.before('<h2>'+ $('caption', myTable).html() 
+'</h2>').addClass('accessHide');

Original comment by scottj...@gmail.com on 9 Apr 2010 at 4:36