This is a migrated thread and some comments may be shown as answers.

Display attribute in client-side javascript tooltip

2 Answers 70 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
davidp
Top achievements
Rank 1
davidp asked on 09 Nov 2012, 04:58 AM
I am currently displaying Start, End and Subject in a javascript tooltip but I would like to also display an additional field(PhoneNumber) that is setup as an attribute of the scheduler.  According to the demo at http://demos.telerik.com/aspnet-ajax/scheduler/examples/radtooltip/defaultcs.aspx this should be possible via javascript but I am not sure how to get the attribute so it can be displayed.
Thanks in advance for any help with this. 
function OnClientRequestStart(sender, args) {
    args.set_cancel(true);
    var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
    if (tooltip) {
        var element = tooltip.get_targetControl();
        var apt = $find("<%=RadScheduler1.ClientID %>").getAppointmentFromDomElement(element);
        $get("startTime").innerHTML = apt.get_start().format("MM/dd/yyyy HH:mm");
        $get("endTime").innerHTML = apt.get_end().format("MM/dd/yyyy HH:mm");
        $get("descriptionDiv").innerHTML = apt.get_subject();
        tooltip.set_text($get("contentContainer").innerHTML);
    }
}
<telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Width="320" Height="170"
    Animation="None" HideEvent="Default" Text="Loading..." OnAjaxUpdate="RadToolTipManager1_AjaxUpdate" />
     <div style="display: none;">
    <div id="contentContainer">
        Starts on: <span id="startTime"></span>
        <br />
        Ends on: <span id="endTime"></span>
        <hr />
        Description:
        <div id="descriptionDiv">
        </div>                       
    </div>
</div>

2 Answers, 1 is accepted

Sort by
0
davidp
Top achievements
Rank 1
answered on 12 Nov 2012, 02:32 PM
Any examples on how to achieve this?  
PhoneNumber is a customattribute of my scheduler and I would like to display it in a client-side tooltip along with Subject, Start and end.

Thanks
0
Accepted
Plamen
Telerik team
answered on 13 Nov 2012, 11:50 AM
Hi,

 
You can set the value of the appropriate custom attribute as in the code below by getting it from the appointment's client object as shown in the code below:

function OnClientRequestStart(sender, args) {
          args.set_cancel(true);
          var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
          if (tooltip) {
              var element = tooltip.get_targetControl();
              var apt = $find("<%=RadScheduler1.ClientID %>").getAppointmentFromDomElement(element);
              $get("startTime").innerHTML = apt.get_start().format("MM/dd/yyyy HH:mm");
              $get("endTime").innerHTML = apt.get_end().format("MM/dd/yyyy HH:mm");
            
              $get("descriptionDiv").innerHTML = apt.get_attributes().getAttribute("PhoneNumber");
              tooltip.set_text($get("contentContainer").innerHTML);
          }
      }

Hope this will be helpful.

Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
davidp
Top achievements
Rank 1
Answers by
davidp
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or