PDA

View Full Version : setvisible(true) causes my code to go into an endless recursion.help needed



omripe
1 Sep 2010, 9:11 AM
hi:)
I have implemented a tooltip for each cell in my gridpanel.when I hover over an empty cell I need the tooltip to be invisible(otherwise an empty tooltip is shown..).when I use the tooltip.setVisible(true) after hiding it, my code goes into endless recursion...


The code for the tool tip is taken from the following thread: http://extjs.com/forum/showthread.ph...259#post265259 (http://extjs.com/forum/showthread.ph...259#post265259)

and here is the code from the thread which is very similiar to my code:
Ext.override(Ext.ToolTip, {
onTargetOver : function(e){
if(this.disabled || e.within(this.target.dom, true)){
return;
}
this.clearTimer('hide');
this.triggerElement = e.getTarget();
this.targetXY = e.getXY();
this.delayShow();
},

onMouseMove : function(e){
this.triggerElement = e.getTarget();
this.targetXY = e.getXY();
if(!this.hidden && this.trackMouse){
this.setPagePosition(this.getTargetXY());
}
},
});

var myGrid = grid;
function updateTipBody(tip) {
var i = myGrid.getView().findRowIndex(tip.triggerElement);
tip.body.dom.innerHTML = "Over row " + i;
}
myGrid.on('render', function() {
myGrid.tip = new Ext.ToolTip({
target: myGrid.getView().mainBody,
trackMouse: true,
renderTo: document.body,
autoHide: false,
listeners: {
move: updateTipBody
}
});
});


and when I call the setvisible method the function, updateTipBody get's called in a recursive way!
can someone please help me??
(the show() method causes the same error)
thank;)

Animal
1 Sep 2010, 9:52 AM
You'd be better off using a DataTip

omripe
1 Sep 2010, 10:58 AM
can you explain?
will a datatip prevent the problem I am talking about?
thanks