ColSpan nd rowSpan

780 views
Skip to first unread message

prateek dhawan

unread,
Mar 9, 2013, 11:10:40 AM3/9/13
to google-visua...@googlegroups.com
I am using the Google's Visualization API to create table but how to set rowspan nd colspan ?

asgallant

unread,
Mar 9, 2013, 1:13:26 PM3/9/13
to google-visua...@googlegroups.com
Sorry, rowspan and colspan are not supported by the API.  You would have to manually modify the HTML table after drawing it in order to have row/colspan.

prateek dhawan

unread,
Mar 9, 2013, 1:30:01 PM3/9/13
to google-visua...@googlegroups.com
Hey thankx for d rply
Can elaborate hw can I do dis? Using jscript?
Some sample code u can provide? ?

prateek dhawan

unread,
Mar 9, 2013, 1:30:04 PM3/9/13
to google-visua...@googlegroups.com

asgallant

unread,
Mar 9, 2013, 2:21:36 PM3/9/13
to google-visua...@googlegroups.com
Here's an example of one way you could do it: http://jsfiddle.net/asgallant/qKWZT/

In that example, I assigned class names to various cells in the table.  Cells with rowspans had a class name of "rowspan_<number of rows to span>" (eg, "rowspan_2"); similarly colspan cells had a class name of "colspan_<number of rows to span>" (a cell with both rowspan and colspan would have two class names applied, eg "rowspan_3 colspan_2").  Any cells that get in the way of the row/col span cells have the class name "delete" applied.  In the table's "ready" event handler, I iterate over the "delete" cells and remove them, and then iterate over the row and col span elements and set their rowSpan/colSpan properties as appropriate.

prateek dhawan

unread,
Mar 10, 2013, 3:28:19 AM3/10/13
to google-visua...@googlegroups.com
Datz Grt
Thankx alot :)
Reply all
Reply to author
Forward
0 new messages