Re: jsf datatable row selection - Websphere

This is a discussion on Re: jsf datatable row selection - Websphere ; You don't need an onload. Just add a <SCRIPT> block right underneath the dataTable that finds the TABLE based on the id, finds its first TR and changes the style....

+ Reply to Thread
Results 1 to 5 of 5

Thread: Re: jsf datatable row selection

  1. Re: jsf datatable row selection

    You don't need an onload. Just add a <SCRIPT> block right underneath the dataTable that finds the TABLE based on the id, finds its first TR and changes the style.

  2. Re: jsf datatable row selection

    thanks yury.
    I will try and get back.


  3. Re: jsf datatable row selection

    Something simple like this should do the trick:
    <script>
    document.getElementById('table1').rows[1].style.backgroundColor="red";
    </script>

  4. Re: jsf datatable row selection

    javascript is at the bottom...not working

    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    <%@page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" session="false"%>
    <portlet:defineObjects />
    <LINK rel="stylesheet" type="text/css"
    href='<%= renderResponse.encodeURL(renderRequest.getContextP ath() + "/theme/stylesheet.css") %>'
    title="Style">
    <f:view>
    <%-- jsfagecode language="java" location="/JavaSource/pagecode/CCAHousHoldInfoView.java" --%><%-- /jsfagecode --%>

    <hx:scriptCollector id="scriptCollector1">

    <STYLE>
    .rowHighlighted{
    background-color:#8C92C6;
    }
    </STYLE>

    <h:dataTable id="table1" value="#{sampleData.members}"
    var="varmembers" styleClass="dataTable" headerClass="headerClass"
    footerClass="footerClass" rowClasses="rowClass1"
    columnClasses="columnClass1" border="0" cellpadding="2"
    cellspacing="0">
    <h:column id="column9">
    <f:facet name="header">
    <hutputText styleClass="outputText" value="Column 9" id="text17"></hutputText>
    </f:facet>
    </h:column>
    <h:column id="column2">
    <f:facet name="header">
    <hutputText styleClass="outputText" value="Last Name" id="text3"></hutputText>
    </f:facet>
    <hutputText id="text4" value="#{varmembers.lastName}"
    styleClass="outputText">
    </hutputText>
    </h:column>
    <h:column id="column3">
    <f:facet name="header">
    <hutputText styleClass="outputText" value="First Name" id="text5"></hutputText>
    </f:facet>
    <hutputText id="text6" value="#{varmembers.firstName}"
    styleClass="outputText">
    </hutputText>
    </h:column>
    <h:column id="column7">
    <f:facet name="header">
    <hutputText styleClass="outputText" value="MI" id="text13"></hutputText>
    </f:facet>
    <hutputText id="text14" value="#{varmembers.MI}"
    styleClass="outputText">
    </hutputText>
    </h:column>
    <h:column id="column8">
    <f:facet name="header">
    <hutputText styleClass="outputText" value="SSN" id="text15"></hutputText>
    </f:facet>
    <hutputText id="text16" value="#{varmembers.SSN}"
    styleClass="outputText">
    </hutputText>
    </h:column>
    <h:column id="column5">
    <f:facet name="header">
    <hutputText styleClass="outputText" value="AMI" id="text9"></hutputText>
    </f:facet>
    <hutputText id="text10" value="#{varmembers.AMI}"
    styleClass="outputText">
    </hutputText>
    </h:column>
    <h:column id="column1">
    <f:facet name="header">
    <hutputText styleClass="outputText" value="DOB" id="text1"></hutputText>
    </f:facet>
    <hutputText id="text2" value="#{varmembers.DOB}"
    styleClass="outputText">
    </hutputText>
    </h:column>
    <h:column id="column4">
    <f:facet name="header">
    <hutputText styleClass="outputText" value="Relation" id="text7"></hutputText>
    </f:facet>
    <hutputText id="text8" value="#{varmembers.relation}"
    styleClass="outputText">
    </hutputText>
    </h:column>
    </h:dataTable>

    <SCRIPT type="text/javascript">

    document.getElementById("view<%=renderResponse.get Namespace()%>:table1").rows[1].style.backgroundColor="red";



    </SCRIPT>

    </hx:scriptCollector>
    </f:view>

  5. great it worked!!!!thanks

    It worked yury.Thanks a bunch for your help
    Just removed the link tag that points to the css by default.so what i am going to do is add my style in the css below
    href='<%= renderResponse.encodeURL(renderRequest.getContextP ath() + "/theme/stylesheet.css") %>'
    title="Style">

    should go well
    )

+ Reply to Thread