zoukankan
html css js c++ java
Ext架构分析(5)Layout初识:ContainerLayout
如果学习了Container,你回发现,在Ext2.0中,Container和Layout的关系是密不可分的。任何Container都需要在render方法中使用layout对象进行布局。
让我们先看一下所有layout的父类:ContainerLayout。
实际上,对容器及其item的渲染都是在layout对象的layout方法中实现的。而layout方法是在resize事件中触发的,基于性能的考虑,可以通过配置bufferResize属性实现延迟layout:
onResize:
function
()
{
if
(
this
.container.collapsed)
{
return
;
}
var
b
=
this
.container.bufferResize;
if
(b)
{
if
(
!
this
.resizeTask)
{
this
.resizeTask
=
new
Ext.util.DelayedTask(
this
.layout,
this
);
this
.resizeBuffer
=
typeof
b
==
'
number
'
?
b :
100
;
}
this
.resizeTask.delay(
this
.resizeBuffer);
}
else
{
this
.layout();
}
}
lyout方法会遍历所有的Container子元素并对其进行render:
renderItem :
function
(c, position, target)
{
if
(c
&&
!
c.rendered)
{
c.render(target, position);
if
(
this
.extraCls)
{
var
t
=
c.getPositionEl
?
c.getPositionEl() : c;
t.addClass(
this
.extraCls);
}
if
(
this
.renderHidden
&&
c
!=
this
.activeItem)
{
c.hide();
}
}
else
if
(c
&&
!
this
.isValidParent(c, target))
{
if
(
this
.extraCls)
{
c.addClass(
this
.extraCls);
}
if
(
typeof
position
==
'
number
'
)
{
position
=
target.dom.childNodes[position];
}
target.dom.insertBefore(c.getEl().dom, position
||
null
);
if
(
this
.renderHidden
&&
c
!=
this
.activeItem)
{
c.hide();
}
}
}
查看全文
相关阅读:
给出字符串
Closest
最短路计数(spfa)
Cleaning Shifts
Mr. Young's Picture Permutations
Georgia and Bob
GCD
Cutting Game
SP4191 MSKYCODE
[CQOI2013]新Nim游戏
原文地址:https://www.cnblogs.com/meetrice/p/1206120.html
最新文章
Fliptile (二进制压缩)
Red and Black (找到一个标记一个)
棋盘问题 (八皇后的变形)
BZOJ3544 [ONTAK2010]Creative Accounting
BZOJ1023 [SHOI2008]cactus仙人掌图
BZOJ1690 [Usaco2007 Dec]奶牛的旅行
BZOJ1670 [Usaco2006 Oct]Building the Moat护城河的挖掘
BZOJ1604 [Usaco2008 Open]Cow Neighborhoods 奶牛的邻居
BZOJ3156 防御准备
BZOJ1654 [Usaco2006 Jan]The Cow Prom 奶牛舞会
热门文章
BZOJ1645 [Usaco2007 Open]City Horizon 城市地平线
BZOJ1631 [Usaco2007 Feb]Cow Party
BZOJ1047 [HAOI2007]理想的正方形
佳佳的魔法照片
麻将游戏
猪王争霸
隐藏的信息
FBI序列
删数
平台
Copyright © 2011-2022 走看看