2 Replies Latest reply on Oct 15, 2008 10:30 AM by Anders Norgaard

    extDT with a4j:support onselectionchange not binding var?

    Anders Norgaard Newbie

      Hi,

      Per other threads I have updated to the lates nightly build.

      <rich:extendedDataTable height="200px" width="100%" frozenColCount="3"
       id="fwList" rows="#{firmwaremanager.getRowCount()}"
       value="#{firmwaremanager.getFirmwares()}" var="fw"
       selection="#{firmwaremanager.selection}"
       >
       <rich:column label="Version">
       <f:facet name="header">Version</f:facet>
       <rich:inplaceInput layout="block" value="#{fw.firmwareVersion}"
       id="inplaceversion"
       selectOnEdit="true" editEvent="ondblclick" >
       <a4j:support event="onviewactivated" action="#{firmwaremanager.versionUpdated(fw)}"/>
       </rich:inplaceInput>
       <f:facet name="footer">Version</f:facet>
       </rich:column>
       <a4j:support event="onselectionchange" action="#{firmwaremanager.setSelected(fw)}"/>
      </rich:extendedDataTable>
      


      When I select row the

      firmwaremanager.setSelected(fw)


      is called, but it always recieves null as the argument

      When I edit the rich:inplaceInput

      firmwaremanager.versionUpdated(fw)


      is called, with the correct argument. This is a bug, right?

      Best
      Anders

        • 1. Re: extDT with a4j:support onselectionchange not binding var
          Piotr Kawiak Newbie

           

          "biehl" wrote:

          This is a bug, right?


          I don't really think so.

          Judging from your code I suspect you would like to have selected row passed
          to an action method, but it's not the way to do it. A versionUpdated method receives fw object, but please notice that it is called INSIDE a column component. As far as I know var attribute holds an ACTUAL list item, and so the inplaceInput in the second row will have second item passed into the method. As you are using var outside of column component, the behaviour can be hard to determine - what item do you suspect to get there? The selected one?

          In your action method you can check firmwaremanager.selection object. It should contain selected items' keys, which you can use to retrieve them from your data model.

          • 2. Re: extDT with a4j:support onselectionchange not binding var
            Anders Norgaard Newbie

            Yeah, I was expecting the selected one. As a parallel to rich:suggestionbox which works great as

             <rich:suggestionbox for="cpevendornameInput" suggestionAction="#{firmwaremanager.autocompleteVendor()}" var="vendor" id="fwvendorsuggestion" frequency="0">
             <h:column>
             <h:outputText value="#{vendor.name}"/>
             </h:column>
             <a4j:support event="onselect" action="#{firmwaremanager.setCpeVendor(vendor)}"></a4j:support>
             </rich:suggestionbox>
            



            But, yes I use the keys from firmwaremanager.selection and that works fine. So I was just wondering.

            Best
            Anders