Ext.onReady(function() {        MyButtonUi = Ext.extend(Ext.Button, {
            text: 'MyButton',            initComponent: function() {
                MyButtonUi.superclass.initComponent.call(this);
            }
        });
         
        });请问上述代码这个button为什么没显示出来 ext-base.js 和ext-all.js 均引用正确
因为
Ext.onReady(function(){ 
   
var p = new Ext.Panel({ 
       
title: 'My Panel', 
      
collapsible:true, 
     
renderTo: 'container', 
      
width:400, 
     
html: '<div>123<div>'}); 
});
是可以正常显示的
谢谢 祝大家国庆快乐

解决方案 »

  1.   

    谢谢 自己解决了 要这样写才可以
    MyButtonUi = Ext.extend(Ext.Button, {
                text: 'MyButton',            initComponent: function() {
                    MyButtonUi.superclass.initComponent.call(this);
                }
            });        Ext.onReady(function() {            var a = new MyButtonUi();            var viewport = new Ext.Panel({
                    height: 308,
                    width: 619,
                    title: 'My Panel',
                    renderTo: 'container',
                    items:[a]
                });
            });
        </script>