extjs desktop中桌面图标换行
2020-11-24 07:07
标签:des style ext color width get 在Desktop.js中扩展一个函数 initShortCut : function() { 在createDataView 中添加一个监听 createDataView : function() { 在afterRender 渲染结束时调用函数 afterRender : function() { extjs desktop中桌面图标换行,搜素材,soscw.com extjs desktop中桌面图标换行 标签:des style ext color width get 原文地址:http://www.cnblogs.com/liuhehe/p/3703855.html
var btnHeight = 64;
var
btnWidth = 64;
var btnPadding = 30;
var col =
{
index : 1,
x : btnPadding
};
var row =
{
index : 1,
y : btnPadding
};
var
bottom;
var numberOfItems = 0;
var taskBarHeight =
Ext.query(".ux-taskbar")[0].clientHeight + 40;
var bodyHeight =
Ext.getBody().getHeight()- taskBarHeight;
var items =
Ext.query(".ux-desktop-shortcut");
for ( var i = 0, len = items.length;
i numberOfItems += 1;
bottom = row.y +
btnHeight;
if (((bodyHeight && bottom > (btnHeight + btnPadding))
{
numberOfItems = 0;
col = {
index :
col.index++,
x : col.x + btnWidth +
btnPadding
};
row = {
index : 1,
y
: btnPadding
};
}
Ext.fly(items[i]).setXY([
col.x, row.y ]);
row.index++;
row.y = row.y + btnHeight +
btnPadding;
}
}
var me = this;
return
{
xtype : ‘dataview‘,
overItemCls :
‘x-view-over‘,
trackOver : true,
itemSelector :
me.shortcutItemSelector,
store : me.shortcuts,
tpl : new
Ext.XTemplate(me.shortcutTpl),
listeners : {
resize :
me.initShortCut
}
};
},
var me =
this;
me.callParent();
me.el.on(‘contextmenu‘,
me.onDesktopMenu, me);
Ext.Function.defer(me.initShortCut,
1);
},