Component Control and parameters passing

Version 3

    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"/>
    </h:commandButton>
    

     

    Parameters definition

     

    • 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"/> 
        </a4j:componentControl> 
    </h:commandButton>
    

     

     

    produces:

     

    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"> 
         <a4j:hashParameter>
          <f:param name="key1" value="value1"/>
          <f:param name="key2" value="value2"/>
         </a4j:hashParameter>
        </a4j:componentControl>
       </h:commandButton>
    

     

     

    will produce next call:

     

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

     

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