Forums

Style Columns view based on other columns

Proximate 15 Aug, 2018
Hi at all

Is there a way in ChronoConnectivity to style a Frontend output based on another column?
For example: i have a list with games (team Name A; team Name B; points Team A; Points Team B) the DB is displayed as table. Now i would like to have the name of Team B is colored green if the Number (points) in Team B column is larger then in the column of Team A.

For sure its possible with JS but i'd like to know if we can do such things directly in the view parameters (view type is table)

My Table looks like that:



Note: the Points combines two columns (My.resultat:<span style="font-weight:bold;font-size:20px;">{var:table_results.row.Match.pts_home}:{var:table_results.row.Match.pts_visitor}</span>) so i've got the points in seperate columns in the back...
healyhatman 16 Aug, 2018
Do you mean style the ROWS?

http://www.chronoengine.com/forums/posts/t105507/how-to-add-html-class-to-a-table-row-or-programmatically-to-a-cell

3rd from the bottom.
Proximate 16 Aug, 2018
hy healyhatman
na not directly (but nice Mod!) - i need it for the cells, i've done a quick thing via Browser DevTools and the negatvie / positive classes:


I need some logic like "if( column.pts_home > column.pts_visitor){ add class X} ifelse( column.pts_home < column.pts_visitor ) { add class Y} else {add Class even}"
For The Cells. As writte above - its ok to do so in JS but i have the pts_visitor and the pts_home column not visible in the DOM so i have to do it with my "Points" Column to "get" the informations who had more points...
healyhatman 16 Aug, 2018
<span class ="{var:class_switch}">
Class_switch obviously being a PHP action or whatever that returns the class you want.
healyhatman 16 Aug, 2018
Answer
That will do the CONTENT of the cell obviously not the TD element itself
This topic is locked and no more replies can be posted.