[TYPO3-RTE] Marking odd and even rows in a RTE table

Uschi Renziehausen typo3news at otherone.de
Wed Dec 10 10:53:47 CET 2008


Hi Francois,

reading the docs in this case helps more :-) Of course rtehtmlarea 
supports automaticly alternating rows and columns:

For alternating rows

RTE.classes.tb-zebra-rows {
	name = Zebra rows
	alternating.rows {
		// first row is 1 (odd) not 0
		startAt = 1
		// odd tr in tbody
		oddClass = tr-odd
		// even tr in tbody
		evenClass = tr-even
		// odd tr in thead or .thead
		oddHeaderClass = header-odd
		// even tr in thead or .thead
		evenHeaderClass = header-even
	}
}


For alternating columns:

RTE.classes.tb-zebra-columns {
	name = Zebra columns
	alternating.columns {
		// first column is 1 (odd) not 0
		startAt = 1
		// odd td in tbody
		oddClass = td-odd
		// even td in tbody
		evenClass = td-even
		// odd th on top (either inside thead or tr.thead)
		oddHeaderClass = th-odd
		// odd th on top (either inside thead or tr.thead)
		evenHeaderClass = th-even
	}
}


Allow the relevant classes for table, tr, th, td to show up in the 
blockstyle list:

RTE.default.buttons.blockstyle.tags {
	table.allowedClasses = tb-zebra-rows, tb-zebra-cols
	tr.allowedClasses = tr-odd, tr-even, header-odd, header-even 		 
td.allowedClasses = td-odd, td-even
	th.allowedClasses = header-odd, header-even, th-odd, th-even
}

Since typo3 4.2 classes are added to the already existing classes. As 
tables can be either tb-zebra-rows or tb-zebra-cols and rows and cells 
can be either odd or even but not both, make sure to make the respective 
classes mutually exclusive:

RTE.mutuallyExclusiveClasses {
	10 = tr-odd,tr-even,header-odd,header-even
	20 = td-odd,td-even
	30 = th-odd,th-even
	40 = tb-zebra-cols, tb-zebra-rows
}


To make sure that all classes mentioned above survive the way from RTE 
to database list them under RTE.default.proc.allowedClasses:

RTE.default.proc.allowedClasses := addToList(tb-zebra-rows, 
tb-zebra-cols,tr-odd, tr-even, header-odd, header-even, td-odd, td-even, 
header-odd, header-even, th-odd, th-even, thead)

A note on class .thead: If your table has header cells on top and left, 
the header rows are not wrapped with <thead> for accessibility reasons. 
Instead, you have a markup <tr class="thead tr-odd>.

Hope that helps, Uschi

Francois Suter wrote:
> Hi all,
> 
> Having searched this mailing list, I have come to the conclusion that 
> there's no built-in support for marking (e.g. with a specific CSS class) 
> the odd and even rows of a table defined in the RTE.
> 
> However I'm wondering if it's possible to achieve this during the 
> transformation from DB to FE. I'm not familiar with these processing 
> functions. Any pointers would be greatly appreciated.
> 
> Cheers
> 


More information about the TYPO3-project-rte mailing list