关于Extjs中(uncaught exception: No center region defined in BorderLayout)

本文探讨了在使用ExtJS框架时遇到的一个问题:在尝试显示一个窗口时出现uncaught exception: No center region defined in BorderLayout错误。文章详细介绍了如何通过调整布局设置来解决这一问题,并强调了Firebug在调试过程中的重要作用。
最近,在使用Extjs的过程中,偶然遇到一个奇怪的问题 :就是我初始化了一个窗口,在页面上有一个图标,通过Ext.get("").on("click","")方法点击此图标显示此窗口,但是短短的一段代码,在firefox中老是报:uncaught exception: No center region defined in BorderLayout的错,而且无法显示此窗口。

根据IE的错误信息调试了老半天也没找到哪的毛病,本来就没多少的JS代码,硬是不知道问题出在哪。看了Firefox的提示才明白,意思就是说在layout为border的westpanel中没有定义center region。防止这样的报错就得把layout为border删了或者添加center region,显然如果这个panel没有子panel(items)的话完全没必要设成border layout。查了下ExtJS3.1.1 API documentation,关于border layout的提示有:
1.Any container using the BorderLayout must have a child item with region:’center’. The child item in the center region will always be resized to fill the remaining space not used by the other regions in the layout.
2.Any child items with a region of west or east must have width defined (an integer representing the number of pixels that the region should take up).
3.Any child items with a region of north or south must have height defined.
看来做web开发,firefox中的firebug是非常有用的。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值