关于动态生成Ext.ux.Portlet的问题

//解析数据库值并生成新portal页面...
alert("----------------------!!!!!");
var col1,col2,col3,Porlet,portalid,proet;
function initcolcount(){
        portalid=portal.getID();//得到ID
       new Ext.onReady(function(){ 
          Ext.QuickTips.init();
        var viewport=new Ext.Viewport
        ({    
              layout : 'border',
               cls:'viewport',
               items:[{
               region:'north',
                xtype : 'box',
                el : 'north',
                height : 60,
                html:''
               
               },
               {
           
               id : portalid,
                region:'center',
                xtype : 'portal',
                margins:'0 5 5 0',
                items:[]
               }
               ]
        })
      });
}
function getProlet(){

    var colCount = portal.getColCount();//栏数
    var colScale = portal.getColScale(); //11:1:2//比例数
    var pCount=portal.getPortletCount(); //portlet数组对象
    var values = colScale.split(':');//获取比例
/*       if(colCount!=colScale)
       {
       return ;
       }*/
       if(values.length>0)
       {
            col1=values[0];    
       }
         if(values.length>1)
       {
            col2=values[1];
       }
         if(values.lenght>2)
       {
            col3=values[2];
       }
       
      for(var y=0;y<pCount;y++)//获取索引值
      {    
            var pl=portal.getPortlet(y);//获取一个prolet
            proet= new Ext.ux.Portlet
                 ({
               title:pl.getTitle(),
               height:pl.getHieght() ,
               portletType : 'report-portlet',
               bodyStyle : 'background-image: url(/rsas/images/portal/report.png);background-position:center;background-repeat:no-repeat'                           
                  })
               Ext.getCmp(y).add(proet);   
    }


}





 不知道如何在inintCount的items中调用下面getProlet()方法,请指教...

onReady 不要写在函数里面,这样是错误的,要不然每次调用函数都监听一次页面加载事件

onReady写在最外面,所有function写在他里面..

另外不明白你表达的意思,items里面调用getProlet()方法是什么意思

需要知道你想在什么情况下调用这个方法,人工触发还是自动触发,具体一点才能回答

[code="js"]
//解析数据库值并生成新portal页面...
alert("----------------------!!!!!");
var col1, col2, col3, Porlet, portalid, proet;

function initcolcount() {
portalid = portal.getID(); //得到ID
new Ext.onReady(function () {
Ext.QuickTips.init();
var viewport = new Ext.Viewport({
layout: 'border',
cls: 'viewport',
items: [{
region: 'north',
xtype: 'box',
el: 'north',
height: 60,
html: ''
},
{
id: portalid,
region: 'center',
xtype: 'portal',
margins: '0 5 5 0',
items: []
}]
})
});
}

function getProlet() {

var colCount = portal.getColCount(); //栏数
var colScale = portal.getColScale(); //11:1:2//比例数
var pCount = portal.getPortletCount(); //portlet数组对象
var values = colScale.split(':'); //获取比例
/*       if(colCount!=colScale)
   {
   return ;
   }*/
if (values.length > 0) {
    col1 = values[0];
}
if (values.length > 1) {
    col2 = values[1];
}
if (values.lenght > 2) {
    col3 = values[2];
}

for (var y = 0; y < pCount; y++) //获取索引值
{
    var pl = portal.getPortlet(y); //获取一个prolet
    proet = new Ext.ux.Portlet({
        title: pl.getTitle(),
        height: pl.getHieght(),
        portletType: 'report-portlet',
        bodyStyle: 'background-image: url(/rsas/images/portal/report.png);background-position:center;background-repeat:no-repeat'
    })
    Ext.getCmp(y).add(proet);
}

}
[/code]