PDA

View Full Version : Anout Ext.ComponentLoader



Dengqiao Huang
23 May 2011, 10:35 AM
I try this code:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="../Ext4/resources/css/ext-all.css"/>
<script type="text/javascript" src="../Ext4/bootstrap.js"></script>
<style type="text/css">
</style>
</head>
<body>
<div id="panel1"></div>
<script type="text/javascript">

Ext.onReady(function(){
if(Ext.BLANK_IMAGE_URL.substr(0,4)!="data"){
Ext.BLANK_IMAGE_URL="./images/s.gif";
}

var panel=Ext.create("Ext.Panel",{
renderTo:"panel1",
layout:"auto",
height:500,
width:400,
tbar:[
{text:"Load",scope:panel,handler:function(){
console.log(panel.loader)
}}
]
});


});
</script>
</body>
</html>


Show in the Console:null

So I modified the definition of the panel:


var panel=Ext.create("Ext.Panel",{
renderTo:"panel1",
layout:"auto",
height:500,
width:400,
autoLoad:"c.js",
renderer:"component",
tbar:[
{text:"Load",scope:panel,handler:function(){
console.log(panel.loader)
}}
]
});


The code in c.js:


{xtype:'panel',height:100,width:200,html:"Hello world"}


The c.js loader,but it is rendering html, but not Componet(renderer:"component",).