Results 1 to 3 of 3
Thread: If on cell of table
- 05-03-2010, 09:56 AM #1
Member
- Join Date
- May 2010
- Posts
- 2
- Rep Power
- 0
If on cell of table
Hello
I get information from a database and show it in a table. Simple enough, but I now I want to highlight certain information.
The table looks like this.
Java Code:<ec:table tableId="mainTable" cellpadding="0" cellspacing="1px" rowsDisplayed="20" width="100%" items="infraKnowGallery" var="data" view="eu.cec.ergonomics.taglib.dataGrid.extremecomponents.view.ErgonomicsView" title="${tableTitle}" action="" showPagination="true" showStatusBar="true" showTooltips="true" sortable="true" autoIncludeParameters="false" state="persist"> <ec:row> <fmt:message key="ciscoworks.mac" var="columnTitle" /> <ec:column property="ciscoworks_mac" title="${columnTitle}" sortable="true" headerCell="eu.cec.ergonomics.taglib.dataGrid.extremecomponents.view.ErgonomicsHeaderCell" /> <fmt:message key="ciscoworks.switch" var="columnTitle" /> <ec:column property="ciscoworks_switch" title="${columnTitle}" sortable="true" headerCell="eu.cec.ergonomics.taglib.dataGrid.extremecomponents.view.ErgonomicsHeaderCell" /> <fmt:message key="ciscoworks.port" var="columnTitle" /> <ec:column property="ciscoworks_port" title="${columnTitle}" sortable="true" headerCell="eu.cec.ergonomics.taglib.dataGrid.extremecomponents.view.ErgonomicsHeaderCell" /> <fmt:message key="ciscoworks.vlan" var="columnTitle" /> <ec:column property="ciscoworks_vlan" title="${columnTitle}" sortable="true" headerCell="eu.cec.ergonomics.taglib.dataGrid.extremecomponents.view.ErgonomicsHeaderCell" /> <fmt:message key="ciscoworks.lastseen" var="columnTitle" /> <ec:column property="ciscoworks_lastseen" title="${columnTitle}" sortable="true" headerCell="eu.cec.ergonomics.taglib.dataGrid.extremecomponents.view.ErgonomicsHeaderCell"> <fmt:formatDate pattern="dd/MM/yyyy" value="${data.ciscoworks_lastseen}"/> </ec:column> </ec:row> </ec:table>
More specifically, I want to highlight cells that are either empty or contain a certain string. Coloring them red or something.
I guess a <c:if test=""></c:if> would work fine, but on what would I have to test? And how would I make it color a single cell?
Thanks in advance.
- 05-17-2010, 11:44 PM #2
Member
- Join Date
- May 2010
- Posts
- 3
- Rep Power
- 0
you could use a javascript hightlighting code just customize it dynamically,
Highlight tables on mouseover javascript.
or just add an style attribute on each field you need, your output will be html?
- 05-18-2010, 08:34 AM #3
Member
- Join Date
- May 2010
- Posts
- 2
- Rep Power
- 0
Thank you for your reply.
Indeed, some simple css would do, either embedded or by changing the class of a cell.
But how would I apply that to a single cell, since my code generates all the cells? (see the code in my first post)
I tried to do something like...
But no code would show at all, which makes sense since the column is treated as a column, not a collection of cells.Java Code:<fmt:message key="ciscoworks.vlan" var="columnTitle" /> <c:if test="${ciscoworks_vlan == 'COR'}"> <ec:column property="ciscoworks_vlan" title="${columnTitle}" sortable="true" style="background-color: red;" headerCell="eu.cec.ergonomics.taglib.dataGrid.extremecomponents.view.ErgonomicsHeaderCell" /> </c:if> <c:if test="${ciscoworks_vlan == 'DAA'}"> <ec:column property="ciscoworks_vlan" title="${columnTitle}" sortable="true" headerCell="eu.cec.ergonomics.taglib.dataGrid.extremecomponents.view.ErgonomicsHeaderCell" /> </c:if>
Is there a way to make such code apply during or after the table has been generated, so separate cells exist?
Thanks
Similar Threads
-
How to repaint.refresh the table (table model) with combo box selection envent
By man4ish in forum AWT / SwingReplies: 1Last Post: 01-08-2010, 06:19 AM -
How to Clear the Cell?
By javasaravanan in forum Advanced JavaReplies: 1Last Post: 12-01-2009, 02:14 PM -
Colour Specific Cell within Table
By poddy88 in forum New To JavaReplies: 2Last Post: 04-14-2009, 08:20 AM -
Handling hyperlinks and standard text in a table cell
By itsmegb in forum AWT / SwingReplies: 2Last Post: 02-28-2009, 07:30 AM -
Jframe In Jtable cell
By Clarion in forum AWT / SwingReplies: 4Last Post: 06-23-2008, 04:42 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks