最近在使用ExtJS搭建網頁界面過程中報出錯誤消息,IE中的提示如下:
例外被拋出且未被接住,行19。。。。
Firefox提示如下:
uncaught exception: No center region defined in BorderLayout westpanel.
根據(jù)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.
原來已經說得很清楚了,只是用得時候沒注意啊。
以后調試還是得多用Firefox的Firebug了。