3 Replies Latest reply: Nov 25, 2012 7:15 AM by Alejandro Profet RSS

    CommandToolbarButton - Show/Hide the text.

    938666
      Hi,

      I am using Jdev 11.1.1.5.0

      Query: By default all the buttons will be rendered as icons. But when user click a button (show labels) all the button should have icon + text. Is there any component available to achieve this functionality where i can hide the text/label of the button through a property? Or should i create a Custom Component to achieve this?

      I am thinking of doing the following
      1. Create a declarative component.
      2. Have two CommandToolbarButton (one with icon and another with icon + text)
      3. Retain all the existing property of CommandToolbarButton and add a new property called renderText. (Not sure to how do this... Can someone provide links / steps how to achieve this.)
      4. based on the new property render one of the buttons.

      Please let me know if there is any other simpler way to achieve this.

      Thanks in advance
      Arul
        • 1. Re: CommandToolbarButton - Show/Hide the text.
          Alejandro Profet
          Hi Arul,

          Have you tried something like this?
          <af:commandToolbarButton text="#{viewScope.showLabels eq true ? 'Search' : ''}"
                                   partialTriggers="ctb2"
                                   icon="/images/search.gif"
                                   id="ctb1"/>
          ...
          <af:commandToolbarButton text="Show labels"
                                   partialSubmit="true"
                                   id="ctb2">
            <af:setActionListener from="#{true}" to="#{viewScope.showLabels}"/>
          </af:commandToolbarButton>
          AP
          • 2. Re: CommandToolbarButton - Show/Hide the text.
            938666
            Hi,

            I was wondering whether there is any other simpler approach than the one you have suggested since the application contains lot of buttons. One more thing to keep in mind is that the text feature might be removed in the feature. So if i can do it at centrally at one place instead of modifying each buttons it would avoid rework in the future.

            Thanks,
            Arul
            • 3. Re: CommandToolbarButton - Show/Hide the text.
              Alejandro Profet
              Other way could be to set styleClass="MyCTBNoText" on each af:commandToolbarButton when user click the "cleaner" button (you can do this in a managed bean).
              So the css rule should look like this:
              af|commandToolbarButton.MyCTBNoText::text {
                display: none;
              }
              AP