Results 1 to 3 of 3
  1. #1
    Tovam is offline Member
    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Default 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.

  2. #2
    ardn0001 is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default

    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?

  3. #3
    Tovam is offline Member
    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Default

    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...

    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>
    But no code would show at all, which makes sense since the column is treated as a column, not a collection of cells.

    Is there a way to make such code apply during or after the table has been generated, so separate cells exist?

    Thanks

Similar Threads

  1. Replies: 1
    Last Post: 01-08-2010, 07:19 AM
  2. How to Clear the Cell?
    By javasaravanan in forum Advanced Java
    Replies: 1
    Last Post: 12-01-2009, 03:14 PM
  3. Colour Specific Cell within Table
    By poddy88 in forum New To Java
    Replies: 2
    Last Post: 04-14-2009, 09:20 AM
  4. Replies: 2
    Last Post: 02-28-2009, 08:30 AM
  5. Jframe In Jtable cell
    By Clarion in forum AWT / Swing
    Replies: 4
    Last Post: 06-23-2008, 05:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •