PDA

View Full Version : this.addEvents is not a function while Using Connection Class



parveenbeniwal
23 Jul 2007, 5:06 AM
hi

Here is my sample html page in which i am using Connection Class.

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="/yui-ext/resources/css/ext-all.css" />
<script type="text/javascript" src="/yui-ext/adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="/yui-ext/adapter/yui/ext-yui-adapter.js"></script>
<script type="text/javascript" src="/yui-ext/ext-all.js"></script>
</head>
<body>

<br>

<label id='container'> </label>
<script type="text/javascript">
var div = document.getElementById('container');

var handleSuccess = function(o){
if(o.responseText !== undefined){
div.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
div.innerHTML += "<li>HTTP status: " + o.status + "</li>";
div.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
div.innerHTML += "<li>HTTP headers: <ul>" + o.getAllResponseHeaders + "</ul></li>";
div.innerHTML += "<li>Server response: " + o.responseText + "</li>";
}
}

var handleFailure = function(o){
if(o.responseText !== undefined){
div.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
div.innerHTML += "<li>HTTP status: " + o.status + "</li>";
div.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
}
}

var callback =
{
success:handleSuccess,
failure: handleFailure
};

var connection = Ext.data.Connection({
url: 'index.url'
});

connection.request({
callback: callback
});
</script>
<br>
</body>
</html>



But while using this i am getting following error in Firebug while using Firefox and same in IE6 for the ext-1.1-rc1.

this.addEvents is not a function
http://localhost:8080/yui-ext/ext-all.js
Line 26

Am I doing something wrong ? Although my other samples are running fine which uses Tree and Grids etc from the same library.

jsakalos
23 Jul 2007, 3:59 PM
Try to create the instance of Ext.data.Connection with new keyword:




var conn = new Ext.data.Connection();

parveenbeniwal
23 Jul 2007, 11:02 PM
thanks. It resolved the problem.