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();
}
}
}
查看全文
相关阅读:
模板-树链剖分
bzoj2523 聪明的学生
P1220 关路灯
BZOJ3572 [Hnoi2014]世界树
BZOJ4013 [HNOI2015]实验比较
BZOJ4012 [HNOI2015]开店
BZOJ4011 [HNOI2015]落忆枫音
BZOJ4009 [HNOI2015]接水果
BZOJ4010 [HNOI2015]菜肴制作
BZOJ4008 [HNOI2015]亚瑟王
原文地址:https://www.cnblogs.com/meetrice/p/1206120.html
最新文章
[CQOI2011]动态逆序对
[Usaco2017 Feb]Why Did the Cow Cross the Road II (Platinum)
NOIP-2018
五一清北学堂培训之数据结构(Day 1&Day 2)
堆
最小生成树
Spfa求最短路径+判负环
前向星存图
并查集
一本通之最短路径
热门文章
一本通之信使(弗洛伊德算法)
一本通之 一堆迷宫 (Dungeon Master&走出迷宫&走迷宫)
Dijkstra求最短路径(普通&堆优化)&例题
[bzoj1195] [hnoi2006] 最短母串
[bzoj1087][scoi2005]互不侵犯king
[uva12170]Easy Climb
[bzoj1072] [SCOI2007]排列perm
[bzoj2463]谁能赢呢
[UVa 1619]Feel Good
[ZJOI2008]树的统计——树链剖分
Copyright © 2011-2022 走看看