Shouldn't there be a { after the while?
while(c'mouseover', jsHoverOver); !!!!! Sys.UI.DomEvent.addHandler(cel,'mouseout', jsHoverOut); Sys.UI.DomEvent.addHandler(cel,'click', jsMClk); cell_count++; cel.id ='p' + cell_count; c++; }
That's why I like curly braces like this
{ Code here}Thanks for that. Yes in my code there is. When I posted it it must have changed. Here's the full code again:
var controls_initialized = false;
function initializeControls(){
var e=$get('jsMainTable');
if(e){
var thisdate=new Date();
var rs=e.rows.length-1;
var r=0, lc=e.rows[1].cells.length-1;
var cel, cels, c, cell_count=0;
while(r < rs){
if(e.rows[r].className=='jsIRow'){
cels=e.rows[r].cells;
c=5;
cell_count+=5;
while(c < lc){
cel=cels[c];
Sys.UI.DomEvent.addHandler(cel, 'mouseover', jsHoverOver);
Sys.UI.DomEvent.addHandler(cel, 'mouseout', jsHoverOut);
Sys.UI.DomEvent.addHandler(cel, 'click', jsMClk);
cell_count++;
cel.id = 'p' + cell_count;
c++;
}
}
r++;
}
}
controls_initialized = true;
}
initializeControls();
function pageLoad()
{
if(!controls_initialized){
initializeControls();
}
controls_initialized = false;
}
If you add a function called "dispose" to the HTML element, UpdatePanel will call it at the right time.
So, $get('jsMainTable').dispose = function() { /* dispose in here */ }.
Thanks.
In the dispose function that you suggest, is there a simple method of disposing of all the $addHandler references for all of the cells or would I need to loop through all of the cells and use $clearHandlers ?
You'll have to loop.
No comments:
Post a Comment