4 Replies Latest reply on Jul 5, 2007 12:50 PM by richfacesuser

    rerendering after a  onrowclick in a rich datatable

    richfacesuser

      hi
      I want to rerender the same page using ajax4jsf and rich:datatable on the event of a onRowclick.
      On a rowclick I am able to call the controller method, calculate the value of an attribute and rerender the attribute to a column of the same datatable.
      Code snippet is


      <rich:datatable....
      <a4j:support event="onRowClick" action="#{bean.check}" reRender="checked"/>
      <rich:column....
      ..
      ..
      <rich:column>
      <h:inputtext id="checked" value="#{bean.attr}" />
      </rich:column?
      </rich:datatable>


      Now how can I have the same inputtext field displayed after the datatable.
      I wanted to have something like this


      ..
      ..
      </rich:datatable>
      <h:inputtext id="checked" value="#{bean.attr}" />

      any help is highly appreciated.

        • 1. Re: rerendering after a  onrowclick in a rich datatable

          Updating inputText value from outside is always a challenge in JSF (event without Ajax).
          First of all, put rich:dataTable into a4j:region. If it does not help, add a4j:log on the page and see what the debug window says about updating this "checked"

          • 2. Re: rerendering after a  onrowclick in a rich datatable
            richfacesuser

            I have tried with the <a4j:region and also replaced the inputtext field with an outputtext, in both cases i am not able to rerender outside the scope of the <rich:datatable. Is there any other work around this.
            My bean is in session right now. I just wanted to try putting the attributes in sessions from inside the bean. can any one tell me how to pass the attributes to session from the bean

            • 3. Re: rerendering after a  onrowclick in a rich datatable

              what a4j:log says about the "checked"?

              • 4. Re: rerendering after a  onrowclick in a rich datatable
                richfacesuser

                Hi the following is the log generated. I don't i have anything with related the id "checked" Could you please suggest
                my page looks like

                <rich:datatable..
                <a4j:support event="onRowClick" action="#{master.check}" reRender="checked"/>

                </rich:dataTable>
                <h:outputText id="checked" value="#{somebean.checkedvalue}"/>



                My controller method "check" looks like

                public String check(){
                checkedvalue = "Richfaces";
                return null;
                }






                debug[12:43:52,972]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: click
                debug[12:43:52,972]: NEW AJAX REQUEST !!! with form :j_id_jsp_1850426284_1
                debug[12:43:52,972]: Append hidden control j_id_jsp_1850426284_1 with value [j_id_jsp_1850426284_1] and value attribute [j_id_jsp_1850426284_1]
                debug[12:43:52,972]: Append hidden control autoScroll with value [] and value attribute []
                debug[12:43:52,972]: Append hidden control j_id_jsp_1850426284_1:_idcl with value [] and value attribute []
                debug[12:43:52,972]: Append hidden control j_id_jsp_1850426284_1:_link_hidden_ with value [] and value attribute []
                debug[12:43:52,988]: Append hidden control jsf_sequence with value [1] and value attribute [1]
                debug[12:43:52,988]: Append hidden control javax.faces.ViewState with value [j_id4:j_id5] and value attribute [j_id4:j_id5]
                debug[12:43:52,988]: parameter master:3:j_id_jsp_1850426284_4 with value master:3:j_id_jsp_1850426284_4
                debug[12:43:52,988]: Start XmlHttpRequest
                debug[12:43:52,988]: Reqest state : 1
                debug[12:43:52,988]: QueryString: AJAXREQUEST=j_id_jsp_1850426284_1%3Aj_id_jsp_1850426284_2&j_id_jsp_1850426284_1=j_id_jsp_1850426284_1&autoScroll=&j_id_jsp_1850426284_1%3A_idcl=&j_id_jsp_1850426284_1%3A_link_hidden_=&jsf_sequence=1&javax.faces.ViewState=j_id4%3Aj_id5&master%3A3%3Aj_id_jsp_1850426284_4=master%3A3%3Aj_id_jsp_1850426284_4&
                debug[12:43:52,988]: Reqest state : 1
                debug[12:43:53,019]: Reqest state : 2
                debug[12:43:53,019]: Reqest state : 3
                debug[12:43:53,019]: Reqest state : 4
                debug[12:43:53,019]: Reqest end with state 4
                debug[12:43:53,019]: Response with content-type: text/xml;charset=UTF-8
                debug[12:43:53,019]: Full response content: <?xml version="1.0"?>
                <!--
                -->



                /*<![CDATA[*/ #header h1 {
                text-indent: -9999px; height: 75px; width: 214px;
                background-image: url(images/header.gif); float: left; }
                .table { overflow: scroll; } /*]]>*/

                debug[12:43:53,019]: Header Ajax-Update-Ids not found, search in
                debug[12:43:53,019]: search for elements by name 'meta' in element #document
                debug[12:43:53,019]: selectNodes found 2
                debug[12:43:53,019]: Find
                warn[12:43:53,019]: No information in response about elements to replace
                debug[12:43:53,019]: call selectSingleNode for id= ajax-update-ids
                debug[12:43:53,019]: Hidden JSF state fields:
                debug[12:43:53,019]: Namespace for hidden view-state input fields is undefined
                debug[12:43:53,019]: search for elements by name 'input' in element span
                debug[12:43:53,019]: selectNodes found 2
                debug[12:43:53,019]: Replace value for inputs: 6 by new values: 2
                debug[12:43:53,019]: Input in response: jsf_sequence
                debug[12:43:53,019]: Found same input on page with type: hidden
                debug[12:43:53,019]: Input in response: javax.faces.ViewState
                debug[12:43:53,019]: Found same input on page with type: hidden
                debug[12:43:53,034]: search for elements by name 'INPUT' in element span
                debug[12:43:53,034]: selectNodes found 0
                debug[12:43:53,034]: Replace value for inputs: 6 by new values: 0
                debug[12:43:53,034]: call selectSingleNode for id= _A4J.AJAX.focus
                debug[12:43:53,034]: No focus information in response