PDA

View Full Version : Type mismatch error....



amitamitjhariya
6 Jun 2010, 11:34 PM
I m getting "type mismatch" error in the following code...

"<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/sfa/ext-3.0.3/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="/sfa/ext-3.0.3/examples/tree/ext-all.css">

<script type="text/javascript" src="/sfa/ext-3.0.3/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/sfa/ext-3.0.3/ext-all.js"></script>
<script type="text/javascript" src="/sfa/ext-3.0.3/ext-all-debug.js"></script>

<script type="text/javascript">

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

var children = [{
task:'ColumnTree Example',
duration:'3 hours',
user:'',
cls:'master-task',
iconCls:'task-folder',
children:[{
task:'Abstract rendering in TreeNodeUI',
duration:'15 min',
user:'Jack Slocum',

leaf:true,
iconCls:'task'
},{
task:'Create TreeNodeUI with column knowledge',
duration:'45 min',
user:'Jack Slocum',

leaf:true,
iconCls:'task'
},{
task:'Create TreePanel to render and lock headers',
duration:'30 min',
user:'Jack Slocum',

leaf:true,
iconCls:'task'
},{
task:'Add CSS to make it look fly',
duration:'30 min',
user:'Jack Slocum',

leaf:true,
iconCls:'task'
},{
task:'Test and make sure it works',
duration:'1 hour',


leaf:true,
iconCls:'task'
}]
}];

Ext.onReady(function(){
var tree = new Ext.tree.TreePanel({

columns:[{
header:'Task',
width:330,
dataIndex:'task'
},{
header:'Duration',
width:100,
dataIndex:'duration'
},{
header:'User',
width:100,
dataIndex:'user'
}],

loader:new Ext.tree.TreeLoader()
,width:200
,height:400
,renderTo:Ext.getBody()

,root:new Ext.tree.AsyncTreeNode({
expanded:true
,leaf:false
,text:'Tree Root'
,children:children
})
});
});
</script>
<title id="title">Building A Tree From Static Data</title>
</head>
<body>
</body>
</html>"

Can anybody please let me know what i am diing wrong here.....
thanks in advance.....

7 Jun 2010, 4:11 AM
The first thing is not posting your code inside of code tags.

7 Jun 2010, 4:23 AM
I m getting "type mismatch" error in the following code...


"<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/sfa/ext-3.0.3/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="/sfa/ext-3.0.3/examples/tree/ext-all.css">

<script type="text/javascript" src="/sfa/ext-3.0.3/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/sfa/ext-3.0.3/ext-all.js"></script>
<script type="text/javascript" src="/sfa/ext-3.0.3/ext-all-debug.js"></script>

<script type="text/javascript">

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

var children = [{
task:'ColumnTree Example',
duration:'3 hours',
user:'',
cls:'master-task',
iconCls:'task-folder',
children:[{
task:'Abstract rendering in TreeNodeUI',
duration:'15 min',
user:'Jack Slocum',

leaf:true,
iconCls:'task'
},{
task:'Create TreeNodeUI with column knowledge',
duration:'45 min',
user:'Jack Slocum',

leaf:true,
iconCls:'task'
},{
task:'Create TreePanel to render and lock headers',
duration:'30 min',
user:'Jack Slocum',

leaf:true,
iconCls:'task'
},{
task:'Add CSS to make it look fly',
duration:'30 min',
user:'Jack Slocum',

leaf:true,
iconCls:'task'
},{
task:'Test and make sure it works',
duration:'1 hour',


leaf:true,
iconCls:'task'
}]
}];

Ext.onReady(function(){
var tree = new Ext.tree.TreePanel({

columns:[{
header:'Task',
width:330,
dataIndex:'task'
},{
header:'Duration',
width:100,
dataIndex:'duration'
},{
header:'User',
width:100,
dataIndex:'user'
}],


loader:new Ext.tree.TreeLoader()
,width:200
,height:400
,renderTo:Ext.getBody()

,root:new Ext.tree.AsyncTreeNode({
expanded:true
,leaf:false
,text:'Tree Root'
,children:children
})
});
});

</script>
<title id="title">Building A Tree From Static Data</title>
</head>
<body>
</body>
</html>"

Can anybody please let me know what i am diing wrong here.....
thanks in advance.....

TreePanel does *not* accept *columns* as a configuration paramter. though, that's not your problem.

7 Jun 2010, 4:25 AM
If i run this in a vanilla Ext JS page, I don't get an error (with firebug).

Your "task" properties should be "text" properties.