1 2 Previous Next 15 Replies Latest reply on Sep 12, 2013 8:08 AM by Alexey Shakov

    RF4: <rich:dataTable> re-render single cell with ajax is not possible

    Alexey Shakov Newbie

      Hi *,

       

      in the followinng example, I have a single-column table with input fields placed in its cells.

      Background color of a cell changes from green to red, depending on corresponding input contains something or not.

       

      XHTML:

       

      <?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:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
        xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"
        xml:lang="en" lang="en">
      <h:head></h:head>
      <h:body>
        <a4j:log hotkey="M" mode="popup" />
        <h:form>
          <rich:dataTable value="#{testBean.data}" var="row">
            <rich:column id="cell" style="background-color:#{empty row[0] ? 'red' : 'green'};">
              <h:inputText value="#{row[0]}">
                <a4j:ajax event="change" render="cell" />
              </h:inputText>
            </rich:column>
          </rich:dataTable>
        </h:form>
      </h:body>
      </html>
      

       

      JavaBean(session scope):

       

      public class TestBean {
      
          private static String [][] initdata = {{"test"},{null},{null},{null},{null}}; 
      
          private List<String[]> data = Arrays.asList(initdata); 
      
          public List<String[]> getData() {
              return data;
          }
      }
      

       

      This example does not work.  render="@row" does not work as well.

      To make it work, the value of render-attribute must be replaced with '@body'.

      But i want to avoid the rendering of complete table.

       

      What is wrong with my code? (By the way, similar code works with RF3.x)

       

      Thanks in advance,

       

      Alexey

        1 2 Previous Next