3 Replies Latest reply on Sep 22, 2008 9:25 AM by nbelaevski

    Highlighting output component on value changed from bacing b

    tihomir.smudj

      Hi all,
      what I would like to do is give a highlight effect to column in rich:dataTable or outputtext or outputlabel when the data in that component is changed from backing bean... What I'm trying now is something like this but it works only with onclick or onmouseover...

      <rich:dataTable id="tablica" var="rowData" value="#{testTicker.tickers}"
      captionClass="caption" width="500" align="center">
      ...
      <h:column>
      <h:outputText value="#{rowData.price_old}" id="max_in">
      <rich:effect event="onchange" rendered="true" for="max_in"
      type="Highlight" params="duration:1.8" />
      </h:outputText>
      </h:column>
      ...
      </rich:dataTable>

      any suggestions???
      thnx in advance...

        • 1. Re: Highlighting output component on value changed from baci
          nbelaevski

          Hello,

          You can use name attribute instead of event to create event activation function that is easy to use:

          <script type="text/javascript">
           appEffects = [];
           </script>
          
           <rich:effect for="fadebox" type="Fade" name="appEffects[0]" params="delay:3.0,duration:0.5" />
           <rich:effect for="fadebox" type="Appear" name="appEffects[1]" params="delay:3.0,duration:0.5" />
          
           <rich:panel id="fadebox" styleClass="box">
           <h:outputText value="Click to Activate" />
           </rich:panel>
          
           <script type="text/javascript">
           appEffects[0](); //run 0-th effect just on page load
           </script>


          Re-render this:
          <h:panelGroup id="effectsScript">
           <script type="text/javascript">
           appEffects[x]();
           appEffects[y]();
           ...
           appEffects[z]();
           </script>
          </h:panelGroup>
          to get stored effects for x, y, z indexes executed.

          • 2. Re: Highlighting output component on value changed from baci
            tihomir.smudj

            Thn for replay... but...
            This does not help me...
            I can trigger event body onLoad, onClick, onmouseover and get effect
            But output component onchange... not...

            • 3. Re: Highlighting output component on value changed from baci
              nbelaevski

              Yes, there's no onchange attribute. onchange is the event that is activated by user editing form field, but not by the fact that value has been changed.

              You should write the code that tracks this and then you can use the approach I've described to highlight changes.