PDA

View Full Version : UpdateManager



techno_adi
15 Nov 2006, 6:20 AM
In Update Method,

When i create object passing a elementID which does not exists, in the Update function it access the dom.innerHTML without cheking if the dom is null or not :)

I hope this explaination is clear, if not try creating UpdateManager object passing in elementID which does'nt exists in your page.

jack.slocum
15 Nov 2006, 6:24 AM
That's a bug in your bug, not mine. :)

Silently swallowing errors is not something I do - it makes REAL problems impossible to track. Make sense?

techno_adi
15 Nov 2006, 6:38 AM
Following flags the error this.dom is null in the yui-ext-core file at line number 115, in the update function. Can you tell why this is happening


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Loading Indicaator Example</title>
<style type="text/css">
.loading-indicator {
font-size:8pt;
background-image: url('images/wait.gif');
background-repeat: no-repeat;
background-position: left;
padding-left:20px;
}
#example {
border-right: black 1px solid;
border-top: black 1px solid;
border-left: black 1px solid;
border-bottom: black 1px solid;
background-color: #ffccff;
height:200px;
width:90%;
padding:5px;
margin-bottom:10px;
/*float:left;
/*clear:right;*/
}

</style>
<script type="text/javascript" src="js/yui0114/yahoo-min.js"></script>
<script type="text/javascript" src="js/yui0114/dom-min.js"></script>
<script type="text/javascript" src="js/yui0114/event-min.js"></script>
<script type="text/javascript" src="js/yui0114/dragdrop-min.js"></script>
<script type="text/javascript" src="js/yui0114/animation-min.js"></script>
<script type="text/javascript" src="js/yui0114/connection-min.js"></script>

<script type="text/javascript" src="js/jsb3231/yui-ext-core.js"></script>

<script type="text/javascript">
var ajaxExample = {
ajaxInit : function(){
var mgr = new YAHOO.ext.UpdateManager('example1');//pass the element id here

mgr.onUpdate.subscribe(this.onCallSuccess);//callback for success
mgr.onFailure.subscribe(this.onCallFailure);//callback for failure
mgr.update('LoadingHandler.ashx');//server script to call

},
onCallSuccess : function(oElement,oResponse){
//example.innerHTML = oResponse.responseText;
alert("yep");

},
onCallFailure: function(oElement,oResponse){
alert("failure - example div");
}
};
YAHOO.ext.EventManager.onDocumentReady(ajaxExample.ajaxInit, ajaxExample, true);

</script>
</head>
<body>
<div id="example"> </div>
</body>
</html>

jack.slocum
15 Nov 2006, 6:46 AM
Your div is called example, yet you are trying to render the grid to example1

techno_adi
15 Nov 2006, 6:54 AM
Actually that was intentional to put "1" there just to show that the id (example1) does'nt exists and in such case we have error flagged. I thought it would be better to have a check so that this error doesnt cum up as runtime error, though we can obiviously check first that elementID exists or not before actually creating the object of UpdateManager..