4 Replies Latest reply on May 4, 2010 10:32 AM by Anton Belevich

    Component control and new parameters passign mechanism for 4.x

    Ilya Shaikovsky Master

      ComponentControl overview:

      • componentControl now implemented as a behavior
        • definition by name not supported anymore as behaviors not supports such attachment.
        • attach* attributes removed as not needed.
          • actually I'm not sure why we needed this case in the past. If you want to call it by JS you could just call the operation it defines directly.
        • attach to just html ellements not supported as behaviors mechanism not allows that.
        • wrapping currenlty not supported.
      • functionality remained the same - to find RichFaces client side object for component and to call defined api.


      Simple Example:


      <h:commandButton value="call some js">
          <a4j:componentControl event="click" for="componentId" operation="methodName"/>


      Parameters definition

      We done with prototype which allows to extend 3.3.x way of parameters passing. And finally work on made it works using next definitions:


      simple f:param and a4j:param usage. In this case parameters passed as inline parameters in the same order as defined:


      <h:commandButton value="call some js">
          <a4j:componentControl event="click" for="componentId" operation="methodName">
                <f:param value="stringParam"/>
                <a4j:param noEscape="true" value="event"/> 





      methodName('stringParam', event) call.


      new hashParameter tag

      hashParameter tag implemented in order to create has object from children parameters tags and pass to handler


      in future some action components could start support it in order to place objetc to request map during submission as normal param does.


       <h:commandButton value="submit">
          <a4j:componentControl event="click" operation="foo" for="fooId">
           <a4j:param noEscape="true" value="event"/>
           <a4j:param value="inlineStringParameter"> 
            <f:param name="key1" value="value1"/>
            <f:param name="key2" value="value2"/>



      will produce next call:


      foo(event, 'inlineStringParameter', {key1: 'value1', key2:'value2'})


      hashParameter's could be named using name attribute and nested.