4 Replies Latest reply on Jan 15, 2010 7:30 AM by abhishek_n

    Single rich:toolTip for multiple components [question]

      Hi,

       

      Can I use a single rich:toolTip for mutiple rich:columns.

       

      Consider this case, a table has 200 students as rows and their marks in 15 subjects [columns].

      student name is the first column. remaining columns are subjects.

       

      If I point my mouse on some cell in the middle I want to show Student name and Subject for the cell.

      Attaching a rich:toolTip to wach column is easy. But I want to know whether this kind of code is possible

       

      <rich:column onmouseover="callJavaScriptToShowToolTip('studentObject.name','studentObject.Subject')">

      ........

      </rich:column>

       

      function callJavaScriptToShowToolTip(name,subject){

            set rich tooltip value

      }

       

       

      Thanks

        • 1. Re: Single rich:toolTip for multiple components [question]
          ilya_shaikovsky
          <script type="text/javascript">
                    function showTT(event, text){
                         #{rich:element('shtt')}.innerHTML=text;
                         #{rich:component('shared_tooltip')}.show(event,{});
                    }
               </script>
               <rich:toolTip id="shared_tooltip" attached="false">
                    <h:outputText id="shtt"/>
               </rich:toolTip>
           
          <rich:dataTable value="#{toolTipData.vehicles}" width="400"
                         var="vehicle" rowKeyVar="row" onRowClick="showTT(event, '#{vehicle.make}')">
           
          
          

           

          that works for me. unfortunatelly tooltip not supports dynamical substitutions like drag indicator or calendar. Thats why you have to insert content on your own to tooltip shared instance.

          1 of 1 people found this helpful
          • 2. Re: Single rich:toolTip for multiple components [question]

            Not working.

            funtion call to JS is going.

            This line is getting executed.
            #{rich:element('shtt')}.innerHTML=text;

             

            But in the next line,

                       show(event,{}); is not getting executed.

             

            In the generated html, the 2nd line is generated as

                            document.getElementById('shared_tooltip').component.show(event,{});

            If I add javascript alert

                          alert( document.getElementById('shared_tooltip').component) is giving object Object in alert box

            but,         alert( document.getElementById('shared_tooltip').component.show(event,{}); is not giving any alert.

             

            I am using Firefox browser.

            • 3. Re: Single rich:toolTip for multiple components [question]
              nbelaevski
              Check if there are any JS errors.
              • 4. Re: Single rich:toolTip for multiple components [question]

                yes. getting JS error Object required.