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

Hide all RadToolTips on page upon OnItemDragStarted from RadListView

5 Answers 59 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Mick
Top achievements
Rank 1
Mick asked on 22 Feb 2012, 03:43 PM

I have a number of RdToolTips within 2 RadListView's on a page.

When i drag one element from one RadListView to the other RadListView the RadToolTips keep showing up on mouse hover (as expected on hover).

How can i in Javascript disable all the RadToolTips on the page when OnItemDragStarted client event for RadListView. Thus stopping the RadToolTips from showing up upon hover only when im dragging an element from one RadListView to another.

Any help would be greatly apreciated.

5 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 23 Feb 2012, 11:08 AM
Hello Mick,

The easiest solution which comes first in my mind is the following one:

1) Define a global js flag, e.g toCancel to false
2) Handle the OnItemDragStarted and set the global js variable defined in 1) to true
3) Handle the OnClientDropped and set the global js flag back to false
4) Attach a OnClientBeforeShow handler for the tooltip(s) and call sender.set_cancel(toCancel) there. This will cancel the show in case an item is being dragged when the tooltip should show.

I hope that my reply is detailed enough and helpful, let me know how it goes.

All the best,
Svetlina Anati
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.
0
Mick
Top achievements
Rank 1
answered on 23 Feb 2012, 12:23 PM
Hi Svetlina

I have tried your solution but im getting an error, i have the following code
var toCancel = false;
function CancelToolTip(sender, args){
 sender.set_cancel(toCancel);
}
 
function itemDragStarted(sender, args) {
  toCancel = true;
}
 
function itemDropped(sender, args) {
  toCancel = false;
}

My RadToolTips are as follows:

<telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="Image1" Width="400px" CssClass="RTP" RelativeTo="Element" EnableShadow="true" Position="BottomCenter" Animation="Slide" OnClientBeforeShow="CancelToolTip(this)"
AnimationDuration="300" ShowDelay="200" Skin="Vista" ShowEvent="OnMouseOver" HideEvent="LeaveToolTip" RenderInPageRoot="True">
<div>Test Info</div>
</telerik:RadToolTip>

The error im getting is that set_cancel is not recognised
Any ideas what im doing wrong here?


0
Svetlina Anati
Telerik team
answered on 23 Feb 2012, 01:23 PM
Hello Mick,

 The problem comes from the fact that you have incorrectly attached the client handler of the tooltip. You should attach it in the same manner as you attach any other client handlers for RadControls - without the brackets (which will cause immediate call instead of attach event handler) and you do not need to pass this - the tooltip will be passed as sender automatically.

This being said I suggest to keep the code as it is but to change the markup as follows:

<telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="Image1" Width="400px" CssClass="RTP" RelativeTo="Element" EnableShadow="true" Position="BottomCenter" Animation="Slide" OnClientBeforeShow="CancelToolTip"
  
AnimationDuration="300" ShowDelay="200" Skin="Vista" ShowEvent="OnMouseOver" HideEvent="LeaveToolTip" RenderInPageRoot="True">
  
<div>Test Info</div>
  
</telerik:RadToolTip>


Please, test my suggestion and let me know how it goes.

Greetings,
Svetlina Anati
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.
0
Mick
Top achievements
Rank 1
answered on 23 Feb 2012, 04:57 PM
Hi

Ive tried what you have suggested but i still get an error on set_cancel
I think this is not part of the RadToolTip api properties.
0
Accepted
Svetlina Anati
Telerik team
answered on 23 Feb 2012, 05:06 PM
Hi Mick,

 
Please, accept my sincere apologies for my mistake - you should call the set_cancel method of the args object, not to the sender. This means to keep the last markup (no brackets and no passing this) and only change the js client handler as follows:


function CancelToolTip(sender, args){
  
 args.set_cancel(toCancel);
  
}




All the best,
Svetlina Anati
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
ToolTip
Asked by
Mick
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Mick
Top achievements
Rank 1
Share this question
or