SelectBooleanCheckbox in RIch:datatable

Hello All,
I have data table with some actions(column 1, column 2, column 3 , delete, update)..
And selectBooleanCheckbox for checking before start delete, its must mandatory before any actions.
I added validator vor selectBooleanCheckbox to make it mandatory, but if I have 4 rows, I must select 4 checkboxes for continue actions...
But each row must have his own checkbox:)
How can I improve it...
public void validateCheckbox(FacesContext context, UIComponent component, Object value) {
    if (value instanceof Boolean && ((Boolean) value).equals(Boolean.FALSE)) {
      String clientId = component.getClientId(context);
      bundle = context.getApplication().getResourceBundle(context, "confirm");
      FacesMessage message = new FacesMessage(bundle.getString("warning"));
      throw new ValidatorException(message);
<rich:column>
                      <f:facet name="header">
                        <h:outputText value="#{regForms.action}"/>
                      </f:facet>
                      <h:panelGroup id="actions_panel">
                        <a4j:commandLink                        
                          action="#{EDIT}" value="#{edit}"
                          reRender="name_panel">
                          <a4j:actionparam name="ID" value="#{item.id}" assignTo="#{bean.editTpStatusId}"/>
                        </a4j:commandLink>
                        <a4j:commandLink                        
                          action="#{EDIT}" value="#{deletet}"
                          reRender="name_panel">
                          <a4j:actionparam name="ID" value="#{item.id}" assignTo="#{bean.deleteId}"/>
                        </a4j:commandLink>
                      </h:panelGroup>
                    </rich:column>
                    <rich:column>
                      <f:facet name="header">
                        <h:outputText value=""/>
                      </f:facet>                                            
                      <h:selectBooleanCheckbox style="border:none" id="check"  required="true" value="#{item.checked}"
                                               validator="#{bean.validateCheckbox}"/>               
                      <h:message for ="check" styleClass="validate"/>                                 
                    </rich:column>               I do not know behavior selectBooleanCheckbox in the datatable, I try to reRender checkbox after clicking in action link, but no result.

Check the "Select multiple rows" part of this article for two ways of doing it.
[http://balusc.blogspot.com/2006/06/using-datatables.html]
Although it uses h:dataTable, the idea is just the same.

Similar Messages

  • How to get the index value from rich:dataTable in jsf2.0

    hi,
    I am developing web application using jsf2.0. In this case, I used rich:dataTable tag for display the values from mysql.
    so this is working..
    my problem is, How to select the perticular row or index from the datatable for another processing...
    help me..
    Thanks.

    Hi,
    You need to get the selectedIndex attribute of the drop down element, e.g.
    String ind = web
                   .element(
                        41,
                        "/web:window[@index='0' or @title='Our Business Web Site']/web:document[@index='4' or @name='optBody']/web:form[@name='frmOptions' or @index='0']/web:select[(@name='PathLen' or @index='2')]").getAttribute("selectedIndex");
    System.out.println("Drop down index is: " + ind);
    You can use the Object Browser to get the path to the element you are interested during recording.
    Regards,
    Jamie

  • Using a4j to load a rich:dataTable after the page loads

    I have a rich:dataTable that calls a session bean which executes an SQL query to generate the data to be displayed in the table. Something simple like:
    <rich:dataTable rowClasses="evenRow,oddRow"
    rows="30"
    value="#{Bean.items}"
    var="items">
    where Bean.getItems() performs an SQL query and returns List<Item>.
    The problem is that the query takes a long time to execute (~45 seconds) and I'd like the page to initially load while the query is being executed, displaying a spinner while it loads. Once the query is done, I'd like to update the initially empty table using ajax.
    I set up a spinner using a4j:status and it works fine after the page initially loads (using a rich:datascroller).
    However, the page will not initially load until the query completes, which is a problem because the query is so slow. What happens is the user clicks on the "List Items" tab from my site's homepage, sits there on the same page for 45 seconds with absolutely no visual indication that anything is happening, and then finally is taken to the list of items page.
    What is needed to make the dataTable load via AJAX the first time, as well as all subsequent times?
    Thanks!
    Edited by: rcrowell on Sep 8, 2008 5:42 PM

    rcrowell wrote:
    The issue isn't the PK of the table; the query is joining across many tables and aggregating data from one table in particular with millions of rows. The table has paging, but again that won't help the timinig issues due to the aggregation that must be performed on a large table.
    Surely there must be a way to get the dataTable to always load its data via ajax, and not only after the first time.Well JSF does not have AJAX built-in, so why would there be? Perhaps one of the AJAX-based frameworks has this. I imagine it wouldn't be hard to do with the existing AJAX frameworks even without a built-in component specifically for it. Trigger an AJAX action on load which rerenders a panel which will only contain the dataTable upon the rerendering.
    >
    I think I could do it by adding a 'dataTableRendered' variable to the bean and using a jsFunction to set this variable to True when the page loads, but I'm looking for a better way. (I'm also not 100% sure this would do what I want.)

  • Entity selected from the rich:dataTable with paging issue

    I tend to use rich:dataTable and retrieve entities clicked with this code.
         public final static Object selecionado(final String formulario,final String tabela) {
              try {
                   final UIComponent comp = FacesContext.getCurrentInstance().getViewRoot().findComponent(formulario);
                   final javax.faces.component.UIData data = (javax.faces.component.UIData) comp.findComponent(tabela);
                   return data.getRowData();
              } catch (final Exception e) {
                   throw new IllegalArgumentException("There was an error on select entity from table.\n" +
                             "Form = " +formulario+"\n" +"Tabela:" +tabela+"\n" +"Look up if the names are correct. <h:form id=\""
                             +formulario+"\"> e"+" <h:dataTable id=\""+tabela+">",e);
         }{code}
    ps: I create a column of type h:commandlink and its call to action (which performs this method to see which entity was selected).
    It works perfectly on the first page (rich:datascroller) but when I navigate to another page and click on the link (edit) the code is not even executed (I confirm this on debug mode too) and what happens is that the paging sends me back to page one.
    Is there anything I can do?
    Best regards,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I'm assuming you have <h:messages/> on your page?
    The action events are queued during the Apply Request Values phase of the request. Typically if an action is not queued it is because some state of the components is not same as it was during the Render Response of the previous request. For example, if the value of the rendered attribute somehow changed, a component will not queue an action if it thinks it was not rendered.
    It your case the most likely thing to have changed seems to be the pagination state of the dataTable. The table thinks it is on the first page for some reason during the Apply Request Values phase and so iterates over the data in the first page and never discovers the request flag indicating that an event should be fired for data in the second page. So the action event is not queued, nothing happens in the Execute Action phase and the Render Response phase simply re-renders the existing view.

  • Problem with rich datatable

    Hi, there.
    I'm a newbie in JSF and was trying to build a rich datatable.
    Using the docs of this page I was able to build the header but not a sub table:
    <rich:dataTable
    cellpadding="0" cellspacing="0"
    width="780" border="0">
    <f:facet name="header">
         <rich:columnGroup>
              <rich:column>
                   <rich:spacer />
              </rich:column>
              <rich:column>
                   <h:outputText value="Nome" />
              </rich:column>
              <rich:column>
                   <h:outputText value="Canal" />
              </rich:column>     
              <rich:column>
                   <h:outputText value="PT" />
              </rich:column>
              <rich:column>
                   <h:outputText value="EN" />
              </rich:column>
         </rich:columnGroup>
    </f:facet>
    <rich:subTable>
    <rich:column>
         <h:outputText value="batatas"></h:outputText>
         <f:facet name="footer">
              <rich:spacer />
         </f:facet>
    </rich:column>
    </rich:subTable>
    </rich:dataTable>
    What is wrong with this code? Can anyone help me?
    Thanks in advance.

    But this code shouldn't show anything in the browser?
    I know that I didn't feed it. I've started to test it using hard coded values...

  • A4j:support not working inside rich:datatable

    One of my columns in rich:datatable is h:selectboolencheckbox which i want to select we user clicks a row
    but a4j:support is not working.
                    <rich:dataTable value="#{ch.fdetails}" var="c"  style="width:90%" columns="14">
                           <a4j:support event="onRowClick" action="#{ch.toggle}" reRender="select" ajaxSingle="true"> 
                            <f:setPropertyActionListener target="#{ch.fd}" value="#{c}" /> 
                     </a4j:support>
                   </rich:dataTable> It doesn't even call action on bean which is toggling the chechkbox.

    Hi, I assume you are using <rich:column>
    so try to change event to onselect or onchange and if your action is method call so change
    action="#{ch.toggle}"to
    action="#{ch.toggle()}"

  • Ajax Update of a rich:subTable with rich:dataTable

    Hello,
    i just want to rerender a subtable within a dataTable via ajax request.
    The concrete requirement is just to model a 1-level table tree, such that i am
    able to expand items in the superior table. I have tried different solutions.
    One is, that value.items returns an empty list on not expanded,
    other was to use the rendered attribute at the subtable and/or also
    at a wrapping columngroup.
    Another thing is, that the table obviously requests the
    ajaxKeys attribute at the dataTable, it also returned
    the correkt rows (as integer index keys within a Set),
    but the subtable is never refreshed.
    I have no more idea! Do i only have the possibility
    to update the whole table (this works fine) ?
    When do i really need the ajaxKeys attribute?
    My third question by this way is, is there a nice
    way of doing it using pure client side javascript effects?
    Hope you can help,
    Ijaja
    <rich:dataTable      value="#{bean.list}" var="value" id="table">
         <rich:column colspan="2">
              <a4j:commandLink action="#{value.switchExpanded()}" reRender="subtable">
                   <h:graphicImage id="expandimage" value="#{value.image}"/>
              </a4j:commandLink>
              <h:outputText value="Text"/>
         </rich:column>
         <rich:subTable id="subtable" value="#{value.items}" var="item">
              <rich:column>
                   <h:outputText value="#{item.label1}" />
              </rich:column>
              <rich:column>
                   <h:outputText value="#{item.label2}" />
              </rich:column>
         </rich:subTable>
    </rich:dataTable>

    Hi, thanks for your reply. I looked at the ajax code in that post.
    attrResponse should be called from my Action class (controller class in my case since am using spring)
    However, this is extremely useful if I am expecting the user to do an input for me.
    I need to figure out if a Query is updating table abc ( I plan to do it this way :
    I will get the table name from all update queries being executed (this I dont know how I will do though), and then after the successfull updation I will execute the select query for the same table) and then return the result set in the attrResponse.
    ultimately this will help in updating rows displayed in jsp based on updates done to the database without the page being refreshed. For ex, if my current Jsp is displaying my total no. of employees, which is 2 then if someone updates the table with a third employee, then the third row gets automatically updated.
    am I taking it up in the correct way ?
    Is there another way to do this ?
    Thanks for your time on this.

  • How to use h:selectBooleanCheckbox in a datatable to select multiple rows

    One way here is set a Boolean property like "isSelected" in the javaBean, and binding it with EL in jsp page which like this:
    *<h:selectBooleanCheckbox value="#{var.isSelected}"/>*
    but this break the a well EntityBean construction cause there is a null-meaning property in this bean just for getting data easily. So, if there is any other solutions for this? i use to think use EL like this:
    *<h:selectBooleanCheckbox value="#{backBean.isSelected}">*
    which bind the value to a Boolean type in the backBean ? but the problem here is there is only one boolean, how can it represent all those rows selected?
    the second way is to get the whole view tree from FacesContext, and find all the checkbox component with findComponent() method,but i don't know how connect this to the rows in datatable,which means how to get a object from the checkbox componentID?
    thanks,sorry for my english.

    Here is a copy:
    JSF<h:form>
        <h:dataTable value="#{myBean.dataList}" var="dataItem">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Select" />
                </f:facet>
                <h:selectBooleanCheckbox value="#{myBean.selectedIds[dataItem.id]}" />
            </h:column>
        </h:dataTable>
        <h:commandButton value="Get selected items" action="#{myBean.getSelectedItems}" />
    </h:form>MyBeanpackage mypackage;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    public class MyBean {
        // Init --------------------------------------------------------------------------------------
        private Map<Long, Boolean> selectedIds = new HashMap<Long, Boolean>();
        private List<MyData> selectedDataList;
        // Actions -----------------------------------------------------------------------------------
        public String getSelectedItems() {
            // Get selected items.
            selectedDataList = new ArrayList<MyData>();
            for (MyData dataItem : dataList) {
                if (selectedIds.get(dataItem.getId()).booleanValue()) {
                    selectedDataList.add(dataItem);
                    selectedIds.remove(dataItem.getId()); // Reset.
            // Do your thing with the MyData items in List selectedDataList.
            return "selected"; // Navigation case.
        // Getters -----------------------------------------------------------------------------------
        public Map<Long, Boolean> getSelectedIds() {
            return selectedIds;
        public List<MyData> getSelectedDataList() {
            return selectedDataList;
    }Where each MyData item (dataItem) has an unique 'id' property.

  • Value change listener method on h:selectBooleanCheckbox in h:dataTable

    Hello,
    Does JSF handle value change listeners as expected when they are attached to h:selectBooleanCheckbox components within an h:dataTable?
    In the following example, I have a JSP that has some h:selectBooleanCheckbox components nested in an h:dataTable, and some that aren't. When I bulid and deploy the example to Tomcat 5.5, I can see (using the log4j output) that the value change listener methods for the checkboxes that are NOT in the dataTable are fired, but the ones that are in the dataTable do not get fired.
    I am using Sun's RI of JSF, version 1.1.0.1.
    Thanks,
    Scott
    ----------------------------- JSP:
    <%@ page language="java" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <f:view>
    <h:form>
    <h:dataTable value="#{checkboxBean.beans}" var="thisBean">
         <h:column>
              <h:outputText  value="#{thisBean.id}: " />
         </h:column>
         <h:column>
              <h:selectBooleanCheckbox value="#{thisBean.checked}" valueChangeListener="#{checkboxBean.somethingChanged}" />
         </h:column>
    </h:dataTable>
         <h:panelGrid columns="2">
              <h:outputText value="One:"/>
              <h:selectBooleanCheckbox id="firstOne" valueChangeListener="#{checkboxBean.somethingChanged}" />
              <h:outputText value="Two:"/>
              <h:selectBooleanCheckbox id="secondOne" valueChangeListener="#{checkboxBean.somethingChanged}" />
              <h:panelGroup/>
              <h:commandButton value="Do Stuff" action="#{checkboxBean.doStuff}" />
         </h:panelGrid>
    </h:form>
    </f:view>----------------------------- Beans:
    package workshop;
    import javax.faces.event.ValueChangeEvent;
    import org.apache.log4j.Logger;
    * Test attaching value change listener methods to checkboxes.
    public class CheckboxBean {
        private static final Logger logger = Logger.getLogger(CheckboxBean.class);
        private SomeBean[] beans = null;
        public CheckboxBean() {
            logger.debug("CheckboxBean()");
        public String load() {
            SomeBean[] someBeans = new SomeBean[3];
            someBeans[0] = new SomeBean("firstGuy", false);
            someBeans[1] = new SomeBean("2ndGuy", false);
            someBeans[2] = new SomeBean("third", false);
            this.setBeans(someBeans);
            return null;
        public String doStuff() {
            logger.debug("doStuff()");
            return this.load();
        public void somethingChanged(ValueChangeEvent e) {
            logger.debug("somethingChanged() in component with id " + e.getComponent().getId() );
        public SomeBean[] getBeans() {
            logger.debug("getBeans()");
            return this.beans;
        public void setBeans(SomeBean[] beans) {
            logger.debug("setBeans()");
            this.beans = beans;
    package workshop;
    public class SomeBean {
        private boolean checked = false;
        private String id = null;
        public SomeBean() {
        public SomeBean(String anId, boolean bool) {
            super();
            this.id = anId;
            this.checked = bool;
        public String getId() {
            return this.id;
        public void setId(String id) {
            this.id = id;
        public boolean isChecked() {
            return this.checked;
        public boolean getChecked() {
            return this.checked;
        public void setChecked(boolean checked) {
            this.checked = checked;
    }----------------------------- faces-config.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
      <managed-bean>
        <description>Checkbox bean.</description>
        <managed-bean-name>checkboxBean</managed-bean-name>
        <managed-bean-class>workshop.CheckboxBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
    </faces-config>----------------------------- log4j config:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
        <appender  name="RollingFile" class="org.apache.log4j.RollingFileAppender" >
              <param name="File" value="/Users/scott/workshop/logs/workshop.log"/>
            <param name="Append" value="false"/>
            <param name="MaxFileSize" value="4096KB" />
            <param name="MaxBackupIndex" value="4" />
            <layout class="org.apache.log4j.PatternLayout">
              <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} : %m%n"/>
            </layout>
        </appender>
        <category name="workshop" >
          <priority value="debug" />
        </category>
        <root>
            <priority  value="warn" />
            <appender-ref  ref="RollingFile" />
        </root>
    </log4j:configuration>

    I have Just run into the same problem. When using the following code inside a data table the valueChangeListener event is not fired when the checkbox has it's value changed. Is this a bug?
    I created a simple page with just a form and the selectBooleanCheckbox. This time the valueChangeListener event fired OK. It seems the problem only occurs when the check box is inside the dataTable
    here is the code snippet
    <h:form >
    <h:column>
    <f:facet name="header">
         <h:outputText value="Add to Basket"/>
    </f:facet>
    <h:selectBooleanCheckbox immediate="true" valueChangeListener="#{reportsResultHandler.addToBasket}" value="#{reportsResultHandler.addbasketChecked}" onchange="this.form.submit
    ();"/>                              
    </h:column>
    </h:form>

  • JSF 2.0 h:selectBooleanCheckbox inside h:dataTable

    This is a bug to me... but better discuss it on the forum before
    simple test:
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html">
        <h:head>
            <title>test</title>
        </h:head>
        <h:body>
            <h:form>
                <h:selectBooleanCheckbox value="true" />
                <h:dataTable value="#{headerValues}" var="item" border="1">
                    <h:column>
                        <h:selectBooleanCheckbox value="true" />
                    </h:column>
                    <h:column>
                        <h:outputLabel value="#{item}" />
                    </h:column>
                </h:dataTable>
            </h:form>
        </h:body>
    </html>this is wrongly(second selectbooleanCheckbox has no value attribute, but the first has... as it should) translated into html as
    <body>
    <form enctype="application/x-www-form-urlencoded" action="/SOConfig/test.jsf" method="post" name="j_idt7" id="j_idt7">
    <input type="hidden" value="j_idt7" name="j_idt7"/>
    <input type="checkbox" checked="checked" name="j_idt7:j_idt8"/><table border="1">
    <tbody>
    <tr>
    <td><input type="checkbox" name="j_idt7:j_idt9:0:j_idt11"/></td>
    <td><label>
    {host=[Ljava.lang.String;@b3a89a, user-agent=[Ljava.lang.String;@1025044, accept=[Ljava.lang.String;@e3b250, accept-language=[Ljava.lang.String;@cfda09, accept-encoding=[Ljava.lang.String;@1f3b26c, accept-charset=[Ljava.lang.String;@46ec20, keep-alive=[Ljava.lang.String;@38323f, connection=[Ljava.lang.String;@16afea1, cookie=[Ljava.lang.String;@173124b}</label></td>
    </tr>
    </tbody>
    </table>
    <input type="hidden" autocomplete="off" value="8396162599460143799:8094137883032859720" id="javax.faces.ViewState" name="javax.faces.ViewState"/>
    </form></body>What do you think?
    Any workaround?
    Florin POP

    another variant is to make me a composite component
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:cc="http://java.sun.com/jsf/composite">
        <cc:interface>
            <cc:attribute name="value" required="true" />
            <cc:attribute name="label" />
        </cc:interface>
        <cc:implementation>
            [#{cc.attrs.value}]
            <c:if test="#{cc.attrs.label != null}"><label>#{cc.attrs.label}</label></c:if>
            <c:choose>
                <c:when test="#{cc.attrs.value == 'D'}">
                    <input type="checkbox" checked="checked" id="#{component.clientId}"/>
                </c:when>
                <c:when test="#{cc.attrs.value == 'N'}">
                    <input type="checkbox" id="#{component.clientId}"/>
                </c:when>
                <c:otherwise>
                    <input type="checkbox" id="#{component.clientId}" disabled="true"/>
                </c:otherwise>
            </c:choose>
        </cc:implementation>this either doesn't work in h:dataTable (somehow 'D' or 'N' are not evaluated and i find myself in otherwhise where... amazing where is evaluated as D )
    what am I doing wrong?
    Florin POP

  • Scrollbar in a datatable

    Hi can anyone please tell me what im doing wrong. Iv been trying to put a scroll bar in my datatable but havent managed it.
    Heres my datatable
              <h:panelGrid styleClass="inset_table" rowClasses="verticalAlign" >
                        <h:dataTable
                             cellspacing="2"
                             columnClasses="content_verythin, content_thin, content_normal, content_verywide, content_verythin"
                             styleClass="fillwidth"
                             headerClass="center_heading5"
                             rowClasses="scroll"
                             rows="0"
                             value="#{DeviceEditorBean.interfaces}"
                             binding="#{DeviceEditorBean.interfaceTable}"
                             var="interface">
                             <h:column>
                                  <f:facet name="header">
                                       <h:selectBooleanCheckbox
                                            value="#{DeviceEditorBean.allSelected}"
                                            valueChangeListener="#{DeviceEditorBean.selectAll}"
                                            onclick="document.forms['edit_device_form'].submit()"/>
                                  </f:facet>
                                  <h:selectBooleanCheckbox
                                       value="#{DeviceEditorBean.selected}"
                                       valueChangeListener="#{DeviceEditorBean.selectInterface}"
                                       onclick="document.forms['edit_device_form'].submit()"/>
                             </h:column>
                             <!-- Interface status -->
                             <h:column>
                                  <h:graphicImage url="#{interface.ifOperStatusImg}"/>
                             </h:column>
                             <!-- ifindex column -->
                             <h:column>
                                  <f:facet name="header">
                                       <h:outputText value="#{devicesBundle.IFINDEX} "/>
                                  </f:facet>
                                  <h:outputText value="#{interface.ifIndex}"/>
                             </h:column>
                             <!-- Device Name column -->
                             <h:column>
                                  <f:facet name="header">
                                       <h:outputText value="#{devicesBundle.INTERFACE_NAME}"/>
                                  </f:facet>
                                  <h:outputText value="#{interface.ifDescr}"/>
                             </h:column>
                             <!-- INTERFACE RESET COLUMN -->
                             <h:column>
                                  <f:facet name="header">
                                       <h:outputText value="#{devicesBundle.INTERFACE_RESET}"
                                            title="#{devicesBundle.INTERFACE_RESET_MSG}"/>
                                  </f:facet>
                                  <h:graphicImage styleClass="icon"
                                       url="/images/controls/true.gif"
                                       rendered="#{interface.resetEnabled}"
                                       title="#{devicesBundle.ENABLED}"/>
                                  <h:graphicImage styleClass="icon"
                                       url="/images/controls/false.gif"
                                       rendered="#{interface.resetEnabled==false}"
                                       title="#{devicesBundle.DISABLED}"/>
                             </h:column>
                        </h:dataTable>
    </h:panelGrid>And here are the css styles:
    .inset_table{
         border-style: inset;
         border-width: 1px;
         width: 100%;
         max-height: 450;
         overflow: auto;
    .verticalAlign, .inset_table{
         vertical-align: top;
    .fillwidth{
         width: 100%
    .center_heading5{
         text-align: center;
         font-weight: normal;
         background-color: #CC9966;
         color: #FFFFFF;
         padding: 0 4pt 0 4pt;
         white-space: nowrap;
         width: 0%;
    .scroll {     
         overflow: auto;
         width: 100%;
         vertical-align: top;
         margin-top: 0% ;
    .content_verythin{
         width: 3%;
         background-color: #FFFFFF;
         padding: 0 4pt 0 4pt;
         vertical-align: top;
         text-align: center;
    }there are a few more style in the column classes of the datatable but basically the only difference between them and content_verythin is there widths are increased. Can anyone help me. This list normally gets populated with a lot of items and goes way below the bottom of the screen so i need to get a scrollbar in it.
    Cheers
    joe.

    To my knowledge the RI data table doesn't provide a scroll bar per se . . . it will paginate the results to where you can click on the page number or arrow to move back and forth between pages. To my knowledge you need <div> and <layer> and a bunch of DHTML tricks to actually make a table scroll (while keeping the header in place). It's not easy and must be customized for each page.
    The JCreator Studio people demonstrated some fancier dataTable widgets at JavaOne . . . that might be worth a look. MyFaces may also have a more feature-rich dataTable implementation, and I'm sure there are others as well.

  • Custom Cell in DataTable

    Hi Guys,
    need you for a little question, I have a dataTable and dynamic columns:
    <rich:dataTable var="item" value="#{class.method}"
                          styleClass="reportTable">
            <h:column>
              <f:facet name="header">
                <h:outputText value="xx" styleClass="firstCellContent"/>
              </f:facet>
              <h:outputText value="#{item.getLastName()}" styleClass="firstCellContent"/>
            </h:column>
            <c:forEach var="yy" items="#{class.getYY()}">
              <h:column>
                <f:facet name="header">
                  <h:outputText value="#{yy}"/>
                </f:facet>
                <h:outputText value="#{item.getFoo(yy)}" />
              </h:column>
            </c:forEach>
          </rich:dataTable>getFoo return a value between 0 and 100.
    I need to apply different styleClass for number from 0 to 20, 21 to .... etc
    I can for sure doing it with rendered..
    but I want to do it properly in the Java code.... What is the best ?
    I tried some binding tricks but without expecting results, I couldnt get the dynamic Cell Value
    Thx

    That code snippet won't even run.
    Anyway, regarding to your actual question: you can just use EL in the styleClass attribute. Either write a conditional expression which takes the value in evaluation, or write a new method in the row object which returns the right styleClass value.

  • Command Buttons in DataTable

    Hello ,
    I have a page which searches all my clients accrding to some criteria, and results are shown in a table(see code bellow please ) for each row I have one CommandButton which in theory should navigate to another page , and edit the details of each client .
    <h:form>
    <rich:dataTable id="prospectoTable" value="#{SearchProspecto.prospectoItems}"
                    var="prospecto" rowKeyVar="index"
                    onRowMouseOver="this.style.backgroundColor='#FFE4E1'"
                    onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" >
        <h:column>
            <f:facet name="header">
                <h:outputText  value="#" />
            </f:facet>
            <h:outputText value="#{index+1}" />
        </h:column>
        <h:column>
            <f:facet name="header">
                <h:outputText  value="Identificacion" />
            </f:facet>
            <h:outputText value="#{prospecto.identificacion}" />
        </h:column>
        <h:column>
            <f:facet name="header">
                <h:outputText  value="Id Alterna" />
            </f:facet>
            <h:outputText value="#{prospecto.idAlterna}" />
        </h:column>
        <h:column>
            <f:facet name="header">
                <h:outputText  value="Nombre" />
            </f:facet>           
            <h:outputText value="#{prospecto.fullName}" />
        </h:column>
        <h:column>
            <f:facet name="header">
                <h:outputText  value="Estado" />
            </f:facet>           
            <h:outputText value="#{prospecto.status}" />
        </h:column>
        <h:column>
                <h:commandButton immediate="true" value="Editar" action="#{SearchProspecto.editar}"  >
                    <f:setPropertyActionListener value="#{prospecto.id}" target="#{SearchProspecto.prospectoIdSelected}" />               
                </h:commandButton>
        </h:column>
        <%--
        <rich:componentControl  event="onRowDblClick" for="propectoDetails" operation="show">
            <f:param value="#{prospecto.id}" name="prospectoId" />
        </rich:componentControl>
        --%>
    </rich:dataTable>
    </h:form>The issue I have right now it is that backing bean code, gets called but navigation does not occur:
    This is my backing bean code:
    public String editar() throws NamingException, SQLException {
            System.out.println("prospecto_id="+prospectoIdSelected);
            Prospecto prospecto = Prospecto.getProspectoById(prospectoIdSelected);
            FacesUtil.setRequestMapValue("prospecto", prospecto);
            if (prospecto.getTipoCliente() == 1) {
                System.out.println("editar_empresarial");
                return "editar_empresarial";
            } else {
                System.out.println("editar_individual");
                return "editar_individual";
        }and my navigation rules in faces-config.xml:
    <navigation-rule>
            <from-view-id>/Prospectacion/searchProspecto.jsp</from-view-id>
            <navigation-case>
                <from-outcome>editar_empresarial</from-outcome>
                <to-view-id>/Prospectacion/editProspecto_e.jsp</to-view-id>           
            </navigation-case>
            <navigation-case>
                <from-outcome>editar_individual</from-outcome>
                <to-view-id>/Prospectacion/editProspecto_i.jsp</to-view-id>
            </navigation-case>
        </navigation-rule>So my question is :
    *1. Is it a bug ? why navigation does not occur ( action method gets invoked though) ?*
    *2. I have to keep the bean in session scope , if use request scope, commadButton wont work (even action method wont be invoked) Why ? I have seen in old post ..this is a bug...but I am using SUN JSF Implementation 1.2 ....Does it still persist ?* since search could be very big...I dont want to save that in session
    My software is :
    JBOSS 4.2.2GA
    JSF 1.2
    JDK 1.6
    Edited by: deibys on Jan 25, 2008 6:10 AM

    deibys wrote:
    *1. Is it a bug ? why navigation does not occur ( action method gets invoked though) ?*Either the view ID's or the outcome of the navigation case is simply invalid. Hint: it has to be covered by the FacesServlet mapping.
    *2. I have to keep the bean in session scope , if use request scope, commadButton wont work (even action method wont be invoked) Why ? I have seen in old post ..this is a bug...but I am using SUN JSF Implementation 1.2 ....Does it still persist ?* since search could be very big...I dont want to save that in session That is certainly not a bug, but just unawareness of the JSF lifecycle. A new request means new initial data. In case of datatables, make sure that the datamodel is exactly the same in the next request. Otherwise move the datamodel to a session scoped bean and inject it in the request scoped bean.

  • DataTable bug?

    I cant seem to get this working and have no idea why.
    <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
    <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <html>
    <head>
    <title>evidence</title>
    </head>
    <body>
          <f:view> 
          <h:outputText value="#{bean.evidence.evidenceid}" />
            <h:form>
                <rich:datascroller align="left"  for="evidenceList" maxPages="20" />
                <rich:spacer height="30" />
                <rich:dataTable  rows="10" id="evidenceList" value="#{bean.allEvidence}" var="ev">
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="EvidenceId" />
                        </f:facet>
                        <h:outputText value="#{ev.evidenceid}" />
                   </h:column>
                   </rich:dataTable>
            </h:form>
    </f:view>
    </body>
    </html>
    <h:outputText value="#{ev}" /> works and I see the bracketed toString output of the object e.g. [[1],[1]]
    Bean -:
    package uk.ac.ukoln.impact.bean;
    import java.util.ArrayList;
    import java.util.List;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.Persistence;
    import uk.ac.ukoln.impact.entity.Evidence;
    public class Bean {
         String text;
         public Bean() {
         public String getText() {
         return text;
         public void setText(String text) {
         this.text = text;
         public Evidence getEvidence() {
              Evidence e = new Evidence();
              e.setEvidenceid(100);
              e.setMsginid(100);
              return e;
         public List<Evidence> getAllEvidence() {
              EntityManagerFactory emf = Persistence.createEntityManagerFactory("example");     
            EntityManager  em = emf.createEntityManager();
            List<Evidence> evidences = null;
            try {
                em.getTransaction().begin();
                return em.createNativeQuery("SELECT * FROM evidence").getResultList();
            } catch(Exception ex) {
                em.getTransaction().rollback();
            } finally {
                em.close();
              return null;
    }Entity -:
    package uk.ac.ukoln.impact.entity;
    import java.io.Serializable;
    import java.util.Set;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.JoinTable;
    import javax.persistence.ManyToMany;
    import javax.persistence.OneToOne;
    @Entity
    public class Evidence implements Serializable {
         @Id
         private int evidenceid;
         private int msginid;
         @OneToOne
         @JoinTable(name="report_evidence",
              joinColumns=@JoinColumn(name="evidenceId"),
              inverseJoinColumns=@JoinColumn(name="reportId"))
         private Set<Report> reportCollection;
         private static final long serialVersionUID = 1L;
         public Evidence() {
              super();
         public int getEvidenceid() {
              return this.evidenceid;
         public void setEvidenceid(int evidenceid) {
              this.evidenceid = evidenceid;
         public String getEid() {
              return "jggf";
         public void setEid(String Eid) {
         public int getMsginid() {
              return this.msginid;
         public void setMsginid(int msginid) {
              this.msginid = msginid;
         public Set<Report> getReportCollection() {
              return this.reportCollection;
         public void setReportCollection(Set<Report> reportCollection) {
              this.reportCollection = reportCollection;
    }I am using tomcat 6, jsf1.2 latest and richfaces - the problem is still there with h:dataTable and all standard taglibs.
    I am sure I must be missing something easy but cant figure this one out. Any help appreciated.

    Forgot the stack
    SEVERE: Servlet.service() for servlet Faces Servlet threw exception
    java.lang.NumberFormatException: For input string: "evidenceid"
         at java.lang.NumberFormatException.forInputString(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at javax.el.ListELResolver.coerce(ListELResolver.java:166)
         at javax.el.ListELResolver.getValue(ListELResolver.java:51)
         at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
         at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:73)
         at org.apache.el.parser.AstValue.getValue(AstValue.java:97)
         at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
         at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
         at javax.faces.component.UIOutput.getValue(UIOutput.java:184)
         at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:284)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154)
         at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:850)
         at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286)
         at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
         at org.richfaces.renderkit.AbstractTableRenderer.encodeOneRow(AbstractTableRenderer.java:246)
         at org.richfaces.renderkit.AbstractRowsRenderer.process(AbstractRowsRenderer.java:87)
         at org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:101)
         at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:994)
         at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:107)
         at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:92)
         at org.richfaces.renderkit.AbstractRowsRenderer.encodeChildren(AbstractRowsRenderer.java:139)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:826)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
         at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:826)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
         at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:273)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:204)
         at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
         at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
         at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
         at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)

  • Problem whit  a4j:poll and rich:datascroller

    Hi all,
    I'm using JSF in conjuction whit RichFaces and i'm experiencing a really strange problem:
    I made a simple jsf page who have a <a4j:poll> polling a request every 10 seconds, a <rich:datatable> who use a org.ajax4j.model.ExtendedDataModel and a <rich:datascroller>.
    This is my jsf page:
    <a4j:region id="regionPoll" immediate="true">
    <h:form id="polling_form">
    *<a4j:poll id="order_poll" interval="10000" reRender="order_num" limitToList="true" immediate="true" ajaxSingle="true"/>*
    </h:form>
    </a4j:region>
    <h:outputText id="order_num" value="#{testPool.randomNumber}"/>
    <div align="center">
    <h:form>
    *<rich:dataTable id="orders" value="#{testPoolView}" var="order" rows="15" width="70%">*
    <rich:column id="col_1" width="100px">
    <f:facet name="header">
    <h:outputText value="Column 1"/>
    </f:facet>
    <h:outputText value="#{order.id}"/>
    </rich:column>
    </rich:dataTable>
    *<rich:datascroller id="scrollerOrders" for="orders" maxPages="3" ajaxSingle="true" immediate="true"/>*
    </h:form>
    When the page is loaded for the first time, everything's fine.
    The very strange think is then user click on datascroller to navigate pages, a call to getRowCount() method is made every 10 seconds (every time the poll activates) !
    This weird behavior occurs only if <a4j:poll> is used in the page.
    As you can see i tried to put parameters to rerender only the h:outputtext , so i wonder why the framework try to update also the datascroller calling the getRowCount method (every 10 seconds ! ).
    Please help me, i searched everywhere on Google but have not found an answer.
    Thanks in advance.

    While I do not know if this is a fact, I suspect that the entire page of components is processed during the Restore View phase even though a subset is processed in the Render Response phase.

Maybe you are looking for

  • Can anyone shed some light on this?

    We are having problems running two iPhones.  When a setting is changed on one one it changed the other.

  • GL transaction and Offset Account

    Hi, I have set the opening balance amount and offset in suspense account. After that, I found that there are not balance in between the GL Account. Which mean I try to enter the opening balance amount into that G/L account which already have transact

  • Does the iPhone 4S problem of reducing the signal quality? ("capture of death")

    Does the iPhone 4S problem of reducing the signal quality? ("capture of death")

  • Can't I call a function this way?

    I tried to get records from a table from server A (Sybase) and insert the records to server B (Oracle) using CF8 Both has the same exact table and datatype When I do the following, I got this error and not sure where I did wrong Missing argument name

  • MULTIPLE ARTISTS IN ONE AL

    hi, i hope that somebody could help me on this. i've been looking for some solutions in the forum but can't find it. for zen users, it is always hard to copy multiple artists in one album in the zen without scattering this artists everywhere. hope th