EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: A-K on November 07, 2014, 02:27:02 AM



Title: Tooltip with condition
Post by: A-K on November 07, 2014, 02:27:02 AM
Hey, I am trying to build a tooltip for all the the rows in the datagrid, I have managed to do so but I have a problem.
I need to show the tooltip only at some conditions and the problem is that the tooltip does not have something like: 'onBeforeShow'
which then I could easly check my condition and return false if I dont want it to open.

But in his current state I could only put the condition in the 'onShow', but when I hide it in that event you can see the tooltip open and close.
Is there any way to achieve this?

Thanks!


Title: Re: Tooltip with condition
Post by: stworthy on November 07, 2014, 08:12:08 AM
You can move the tip message to the invisible area in the 'onShow' event handler.
Code:
$('#tt').tooltip({
onShow:function(){
if (somecondition){
$(this).tooltip('tip').css({
left:-1000000
})
}
}
})


Title: Re: Tooltip with condition
Post by: A-K on November 07, 2014, 08:43:22 AM
Thanks works great!