2 Replies Latest reply on Jun 8, 2011 5:44 PM by giberius

    extendedDataTable

    giberius

      I have put two data tables A en B in one screen. In each table I place a list with three records.

       

      The problem: when I jump around between record 1 of table A and record 1 of table B the onselectionchange does not fire. More precise if I jump for record x of table A to record x of table B the onselectionchange does not fire (and x is one and the same record number).

       

      I use the onselectionchange for a master-detail screen: on the onselectionchange of the master I fetch the details which belongs to that master. When a user selects a different master the details are fetched. So above problem prevents me from building this master-detail screen (A is master and B is detail).  E.g. a sequence of  steps which show the unwanted behaviour:

      Step 1: Table A => select record one (so the details of record one are presented)

      Step 2: Table B => select record three

      Step 3: Table A => select record three, onselection change does not fire, table A now "thinks" that record three is selected, the required behaviour is the onselectionchange trigger to fire so that detail records of master record three are presented. If I would have jumped on master record one, which is already selected, then indeed the onselection change does not need te be fired.

       

       

      I think that if you jump around in different fields of one recored in the same table then the onselectionchange should not fire but if I jump between two different tables the onselectionchange should fire.  It seems that the last record selected in a table seems te be "remembered" as the selected record for both table, while the memory of the currect selected record should be there for each table separate. So I consider this as a bug or at last unexpected behaviour.

       

      Correct woud be:

      Step 1: Table A, record one

      Step 2: Table B, record two

      Step 3: Table A, record two (fire onchange)

      Step 4: Table B, record two (no fire of onchange)

      Step 5: Table A, record two (no fire of onchange)

      etc.

       

       

      Quesions:

      1) Does somebody see a work around for above problem? I already put then in differents forms, did not make a difference.

      2) Can I get this on the bug list?      

        • 1. Re: extendedDataTable
          giberius

          I have not found a work around myself. It their an other way to get a trigger and selected record then the onselectionchange?

           

          My use case is a master-detail screen with a multi-record master and a multi-record detail. I think a usefull usecase.

           

          I would like to get this on the issue-list, how should I do this?

           

           

          Test code to show the problem:

           

          <h:form id="tom" prependId="false" >

          Lijst A

                    <rich:extendedDataTable

                              value="#{test.a}"

                              var ="lijstA"

                              onselectionchange="alert('a')"

                        >

           

                    <rich:column>

                         <h:inputText value="#{lijstA.naam}" />

                    </rich:column>

                </rich:extendedDataTable>

          </h:form>

           

          <h:form id="gib" prependId="false" >

          Lijst B

               <rich:extendedDataTable

                    value="#{test.b}"

                    var ="lijstB"

                     onselectionchange="alert('b')"

                    >

                    <rich:column>

                         <h:inputText value="#{lijstB.naam}" />

                    </rich:column>

               </rich:extendedDataTable>

          </h:form>

           

           

          The real code I use in the master table:

           

          <rich:extendedDataTable id ="rolTabel"

           

           

               value ="#{rolBean.lijst}"

           

               var ="lijst"

           

               style ="max-height: 700px ; width: 985px; margin: 5px 5px 5px 5px"

                selection ="#{rolBean.selection}"

           

               selectionMode ="single"

           

               noDataLabel ="#{tekst.emptymessage}"

          >

              

           

               <f:facet name="header">              

                    <h:outputText value="#{rol.tabelTitel}" />

           

               </f:facet>

            

                 <a4j:ajax execute ="rolTabel"    

           

                         render ="form"

           

                         event ="selectionchange"

                         listener ="#{rolBean.selectionListener}"

                  />

          The real code I use in the Detail Table:

          <rich:extendedDataTable id ="schermitemTabel"

                    value ="#{rolBean.selected.schermiteminrolEntityCollection}"

                    var ="lijst2"

                    style ="max-height: 700px ; width: 985px; margin: 5px 5px 5px 5px"

                    selection ="#{rolBean.detailSelection}"

                    selectionMode ="single"

                    noDataLabel ="#{tekst.emptymessage}"

          >

          The managed bean contains a list of JPA entities in which a master-detail relation is set up, so every master entity has a collection of detail. The onselectionchange of the master set the new selected and I set the collection of that as value for the detail table.

          (Of the record: Working with JPA entities is nice, is in case of a rollback by the database your entities in memory are not rolled back, so the version field for optimistic locking is then not rolled back and also if you have got a pk from the database you better set this back to zero while the possibility exists that an ohter user will get this number from the database, at least which MySQL this will happen).

          • 2. Re: extendedDataTable
            giberius

            I looked with firebug to the generated page. I see on both generated tables the following Javascript code:

             

            new RichFaces.ui.ExtendedDataTable('j_idt22', 3, function(event, clientParams) {RichFaces.ajax("j_idt22",event,{"clientParameters":clientParams,"incId":"1"} );},{"onselectionchange":function(event){alert('a')}} );

            </script>

             

             

            I have no idea with code triggers the onselectionchange and how the JavaScript ends in the page, if I can find out then I can find the program where it goes wrong.