ExtJS[Desktop]实现 图标换行
来源:互联网 发布:手机照片墙软件 编辑:程序博客网 时间:2024/04/29 22:24
ExtJS中的desktop的demo中,默认的图标排列是不换行的,这就造成了如果桌面上的图标过多的话,当超出桌面区域,会造成图标遮盖,即超出桌面区域的部分会被任务栏遮挡,以下代码就是为了解决这一问题的。
首先,在desktop.js中扩展一个函数。
initShortcut : function() { 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 < len; i++) { numberOfItems += 1; bottom = row.y + btnHeight; if (((bodyHeight < bottom) ? true : false) && 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; } }
然后在当前的js文件中的createDataView方法中,添加一个监听器。
createDataView: function () { 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 } }; }
再者,在afterRender渲染结束时调用函数。
afterRender: function () { var me = this; me.callParent(); me.el.on('contextmenu', me.onDesktopMenu, me); Ext.Function.defer(me.initShortcut,1); }
- ExtJS[Desktop]实现 图标换行
- 完美解决Extjs 4 desktop图标换行问题
- ExtJS Desktop桌面图标换行
- ext desktop 图标自动换行问题
- 完美解决desktop图标换行问题
- 完美解决desktop图标换行问题
- Ext4 desktop 桌面图标换行实现
- extjs4.2 desktop 核心文件 + 换行 + 图标拖动
- 带拖拽的Extjs的desktop实现
- ExtJs Desktop
- ExtJS Desktop
- ExtJS desktop 特效网站
- extjs desktop解析 【转】
- extjs desktop解析 【转】
- Extjs Web Desktop应用
- extjs desktop startmenu (开始菜单)
- extjs图标
- Extjs中GridPanel实现单元格自动换行的补充-转载
- 第十一周——星号图(函数)
- SD/SDIO协议简介
- 【转载】android中fragment的实现。完全取代选项卡
- 查询OPENGL和WGL是否支持指定扩展
- Acclerated C++ Exercise 5-0(list)
- ExtJS[Desktop]实现 图标换行
- 判断闰年
- 任务1——猜数字游戏
- 等概率随机函数和任意概率随机函数
- 联想F31,老机换新颜--Win8.1安装手记
- Replication on redis
- nyoj-236-心急的C小加
- u-boot源码分析
- Java获取客户端IP地址