4 Replies Latest reply on Jun 9, 2007 10:06 AM by Hannes Schulz

    Problem with reRender in dataTable

    Hannes Schulz Newbie

      Hi,

      i have a problem with a dataTable. I render a dataTable which is outjected as Datamodel. within this table there area some radioButtons. with an onchange event i want to disable or not disable an input field in the same row. but it doesent work.

      <h:dataTable ...>
       <h:column>
       <a4j:region>
       <h:selectOneRadio id="engineType" value="#{allocatedArea.engineType}">
       <s:convertEnum/>
       <s:enumItem enumValue="NONE" label=""/>
       <s:enumItem enumValue="EXHAUST" label=""/>
       <a4j:support event="onchange" reRender="thisshouldbereRendered"/>
       </h:selectOneRadio>
       </a4j:region>
       <h:column>
       <h:column>
       <a4j:region>
       <h:inputText id="thisshouldbereRendered"
       value="#{allocatedArea.additionalHeatingOutput}"
       disabled="#{allocatedArea.additionalHeatingOutputDisabled}">
       <a4j:support event="onkeyup" requestDelay="50"/>
       </h:inputText>
       </a4j:region>
      </h:column>
      </h:dataTable>
      


      I tried it in serveral ways. i put the id in the region tag, in an outputPanel tag that surrounded the region tag, none of it worked. the strange thing is that the method isAdditionalHeatingOutputDisabled() was executed. i put an log command inside which was executed whenever an onchange event occured.

      after i decided to reRender the whole table it worked.

      Is it impossible to reRender columns within rows on events in a generated dataTable? Can someone explain this behavoir or point me to the mistake made?

      Thanks a lot,
      regards
      hasc


        • 1. Re: Problem with reRender in dataTable
          Mike Maurer Newbie

          I am having a very similar problem with checkboxes in a datatable. Each row has a checkbox in it, and when I check the "Toggle All" checkbox (not in the datatable) I want it to toggle the checkbox value on every row. It does change the values in the backing bean, but I can't get it to visually reRender the checkboxes in the table rows.

          • 2. Re: Problem with reRender in dataTable
            Hannes Schulz Newbie

            can you also verify that the boolean method is executed?

            • 3. Re: Problem with reRender in dataTable
              Hannes Schulz Newbie

              I also tried it with the ajax4jsf1.1.1 release without success.

              It would be great if someone from the developing team could comfirm if this is a bug in the release or a mistake in my/our implementation.

              the problem is the following:

              reRender a component within a row of a dataTable doesnt work.

              In my case i want to disable or enable an inputText field depending on an onchange event executed by another component in the same row.
              the isDisabled() method of the object is executet whenever the onchange event occurs, but the component doest seem to be rerenderd.

              when i reRender the whole dataTable it works.


              thanks and regards
              hasc

              • 4. Re: Problem with reRender in dataTable
                Hannes Schulz Newbie

                a little more research did help.

                http://livedemo.exadel.com/a4j-repeat-rerender/

                so the code looks like that now (and works):

                <h:selectOneRadio id="engineType" value="#{allocatedArea.engineType}">
                 <s:convertEnum/>
                 <s:enumItem enumValue="NONE" label=""/>
                 <s:enumItem enumValue="EXHAUST" label=""/>
                 <a4j:support event="onchange" reRender="thisshouldbereRendered">
                 <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender"/>
                 </a4j:support>
                </h:selectOneRadio>

                i had to remove the region tags around the selectOneRadio, because it threw and exception when i changed the value more than one time.