提供一键恢复功能,点击恢复默认设置即可恢复到原有界面 保存到数据库设置需要建立表Portal 提供下面的字段 private Long id; private String userId;//用户ID private Long portalColumn; private Long portalRow; private String portletId;//容器ID js代码如下: var jsonData; Ext.onReady(function() { Ext.QuickTips.init(); var fullPanel = new FullPanel(); fullPanel.portal.init(); }); Ext.apply(window, { $ : Ext.get, $A : Ext.value, $C : Ext.getCmp, $D : Ext.getDom, $$ : Ext.select, $Q : Ext.query, $on : Ext.EventManager.on, $ready : Ext.onReady, $l : console.log, $cd : console.dir, $for : typeof forEach != 'undefined' ? forEach : Ext.each }); FullPanel = Ext.extend(Ext.Panel, { portal : null, // portal constructor : function() { this.portal = new StartPortal(); FullPanel.superclass.constructor.call(this, { renderTo : Ext.getBody(), id : 'fullPanel', height : Ext.getBody().getHeight(), width : Ext.getBody().getViewSize().width, autoScroll : false, layout : 'fit', bodyStyle : 'padding:0px 0px 0px 0px; overflow-x:hidden;', tbar : [ { xtype : 'label', id : 'onLineMsg', title : '' }, '->', '-', { text : '恢复默认', iconCls : 'resume', handler : this.onResumeClick, scope : this }, '-', { text : '保存我的设置', iconCls : 'save', handler : this.onSaveClick, scope : this }, '-' ] /* * , listeners: { 'render': {fn : this.onRenderEvent, scope: this} } */ }); }, onRenderEvent : function(panel) { }, onResumeClick : function() { try { this.portal.removeAllportlet(); this.portal.restore(); } catch (e) { } }, onSaveClick : function() { var arr = []; if (!this.portal.items || this.portal.items.length == 0) return; for ( var i = 0; i < this.portal.items.length; i++) { var col = this.portal.items.items[i]; for ( var j = 0; j < col.items.length; j++) { var portlet = col.items.items[j]; var portletId = col.items.items[j].id; var rowNum = col.items.indexOf(portlet); var colNum = i; var str = portletId + ',' + colNum + ',' + rowNum; console.info(str); arr.push(str); } } // PortalManager.savePortal(arr, function(data) { // if(data) { // // } else { // // } // }); } }); StartPortal = Ext.extend(Ext.ux.Portal, { leftColumn : null, centerColumn : null, rightColumn : null, treePanel1 : null, treePanel2 : null, treePanel3 : null, treePanel4 : null, treePanel5 : null, treePanel6 : null, constructor : function() { StartPortal.superclass.constructor.call(this, { region : 'center', autoScroll : false, border : false }); }, restore : function() { // 恢复默认 this.initAllComponent(); this.leftColumn.add(this.createPortlet('alarmChartPanel', '告警统计', this.treePanel1)); this.leftColumn.add(this.createPortlet('deviceChartPanel', '故障测试统计', this.treePanel2)); this.centerColumn.add(this.createPortlet('onuChartPanel', '设备统计', this.treePanel3)); this.centerColumn.add(this.createPortlet('testCountPanel', '厂商统计', this.treePanel4)); this.rightColumn.add(this.createPortlet('factoryStaticPanel', 'ONU运行状态统计', this.treePanel5)); this.rightColumn.add(this.createPortlet('topNPanel', '最近TOPN流量统计', this.treePanel6)); this.reDoLayout(); }, init : function() { // 初始化 // if(!jsonData || jsonData.length == 0) { // this.restore(); // return; // } this.initAllComponent(); // for(var i=0, len=jsonData.length; i<len; i++) { // var id = jsonData[i].portletId; // var colNum = jsonData[i].portalColumn; // var rowNum = jsonData[i].portalRow; // var title, panel; // for(var props in this.portletObj) { // if(this.portletObj.hasOwnProperty(props)) { // var propValue = (this.portletObj)[props]; // if(propValue['idx'] === id) { // title = propValue['title']; // panel = propValue['panel']; // break; // } // } // } // if(colNum == 0) { // this.leftColumn.add(this.createPortlet(id,title,panel)); // } else if(colNum == 1) { // this.centerColumn.add(this.createPortlet(id,title,panel)); // } else if(colNum == 2) { // this.rightColumn.add(this.createPortlet(id,title,panel)); // } // } this.leftColumn.add(this.createPortlet('alarmChartPanel', '告警柱统计', this.treePanel1)); this.leftColumn.add(this.createPortlet('deviceChartPanel', '设备统计', this.treePanel2)); this.centerColumn.add(this.createPortlet('onuChartPanel', 'ONU运行状态统计', this.treePanel3)); this.centerColumn.add(this.createPortlet('testCountPanel', '故障测试统计', this.treePanel4)); this.rightColumn.add(this.createPortlet('factoryStaticPanel', '厂商统计', this.treePanel5)); this.rightColumn.add(this.createPortlet('topNPanel', '最近TOPN流量统计', this.treePanel6)); this.reDoLayout(); }, removeAllportlet : function() { // 移除所有的portlet if (this.items && this.items.length > 0) { for ( var i = 0; i < this.items.length; i++) { var c = this.items.itemAt(i); if (c.items) { for ( var j = c.items.length - 1; j >= 0; j--) { c.remove(c.items.itemAt(j), true); } } } } }, initAllComponent : function() { var that = this; this.portletObj = {}; // 所有的portlet this.leftColumn = this.createColumn('left', .33); this.centerColumn = this.createColumn('center', .33); this.rightColumn = this.createColumn('right', .34); // 最近TOP10流量统计 this.treePanel1 = new TreePanel1(); this.treePanel2 = new TreePanel2(); this.treePanel3 = new TreePanel3(); this.treePanel4 = new TreePanel4(); this.treePanel5 = new TreePanel5(); this.treePanel6 = new TreePanel6(); // this.portletObj.treePanel1 = {idx: 'alarmChartPanel', title: '告警柱统计', // panel:this.treePanel1}; // this.portletObj.treePanel2= {idx: 'deviceChartPanel', title: '设备统计', // panel: this.treePanel2}; // this.portletObj.treePanel3= {idx: 'onuChartPanel', title: // 'ONU运行状态统计', panel: this.treePanel3}; // this.portletObj.treePanel4 = // {idx:'testCountPanel',title:'故障测试统计',panel:this.treePanel4}; // this.portletObj.treePanel5 = // {idx:'factoryStaticPanel',title:'厂商统计',panel:this.treePanel5}; // this.portletObj.treePanel6 = // {idx:'topNPanel',title:'最近TOPN流量统计',panel:this.treePanel6}; }, reDoLayout : function() { // 重新布局 this.add(this.leftColumn); this.add(this.centerColumn); this.add(this.rightColumn); var fullPanel = Ext.getCmp('fullPanel'); fullPanel.add(this); fullPanel.doLayout(); }, createPortlet : function(id, title, items) { return new Ext.ux.Portlet({ id : id, title : title, tools : [ { id : 'close', handler : function(e, target, panel) { try { panel.ownerCt.remove(panel, true); // throw new Error("关闭窗口时出现了一个错误!"); } catch (e) { } } } ], style : 'padding:0px 0 5px 0px', items : items }); }, createColumn : function(id, columnWidth) { return new Ext.ux.PortalColumn({ id : id, columnWidth : columnWidth, style : 'padding:5px 0 5px 5px' }); } }); TreePanel1 = Ext.extend(Ext.tree.TreePanel, { constructor : function() { TreePanel1.superclass.constructor.call(this, { id : 'tree1', region : 'center', autoScroll : true, animate : true, width : '280', collapsible : (this.centerRegion == 'center' ? false : true), split : true, enableDD : true, containerScroll : true, border : false, loader : new Ext.tree.TreeLoader({ url : '/neFunction/tes' }), root : new Ext.tree.AsyncTreeNode({ id : "0", level : "0", text : "菜单树" }), rootVisible : true }); } }) TreePanel2 = Ext.extend(Ext.tree.TreePanel, { constructor : function() { TreePanel2.superclass.constructor.call(this, { id : 'tree2', region : 'center', autoScroll : true, animate : true, width : '280', collapsible : (this.centerRegion == 'center' ? false : true), split : true, enableDD : true, containerScroll : true, border : false, loader : new Ext.tree.TreeLoader({ url : '/neFunction/tes' }), root : new Ext.tree.AsyncTreeNode({ id : "0", level : "0", text : "菜单树" }), rootVisible : true }); } }) TreePanel3 = Ext.extend(Ext.tree.TreePanel, { constructor : function() { TreePanel3.superclass.constructor.call(this, { id : 'tree3', region : 'center', autoScroll : true, animate : true, width : '280', collapsible : (this.centerRegion == 'center' ? false : true), split : true, enableDD : true, containerScroll : true, border : false, loader : new Ext.tree.TreeLoader({ url : '/neFunction/tes' }), root : new Ext.tree.AsyncTreeNode({ id : "0", level : "0", text : "菜单树" }), rootVisible : true }); } }) TreePanel4 = Ext.extend(Ext.tree.TreePanel, { constructor : function() { TreePanel4.superclass.constructor.call(this, { id : 'tree4', region : 'center', autoScroll : true, animate : true, width : '280', collapsible : (this.centerRegion == 'center' ? false : true), split : true, enableDD : true, containerScroll : true, border : false, loader : new Ext.tree.TreeLoader({ url : '/neFunction/tes' }), root : new Ext.tree.AsyncTreeNode({ id : "0", level : "0", text : "菜单树" }), rootVisible : true }); } }) TreePanel5 = Ext.extend(Ext.tree.TreePanel, { constructor : function() { TreePanel5.superclass.constructor.call(this, { id : 'tree5', region : 'center', autoScroll : true, animate : true, width : '280', collapsible : (this.centerRegion == 'center' ? false : true), split : true, enableDD : true, containerScroll : true, border : false, loader : new Ext.tree.TreeLoader({ url : '/neFunction/tes' }), root : new Ext.tree.AsyncTreeNode({ id : "0", level : "0", text : "菜单树" }), rootVisible : true }); } }) TreePanel6 = Ext.extend(Ext.tree.TreePanel, { constructor : function() { TreePanel6.superclass.constructor.call(this, { id : 'tree6', region : 'center', autoScroll : true, animate : true, width : '280', collapsible : (this.centerRegion == 'center' ? false : true), split : true, enableDD : true, containerScroll : true, border : false, loader : new Ext.tree.TreeLoader({ url : '/neFunction/tes' }), root : new Ext.tree.AsyncTreeNode({ id : "0", level : "0", text : "菜单树" }), rootVisible : true }); } })
相关推荐
Extjs portal Extjs portal Extjs portal Extjs portal Extjs portal Extjs portal Extjs portal Extjs portal Extjs portal Extjs portal Extjs portal
在EXTJS中,"Portal"组件是一种特殊的布局方式,允许用户自定义和排列页面上的内容区块,类似于个人门户的功能。EXTJS 2.0版本虽然相对较老,但其Portal组件仍然具有很高的实用价值,特别是对于那些需要用户高度...
在"Extjs portal 应用初探"这个主题中,我们将深入探讨如何利用ExtJS构建门户应用。 首先,门户应用是一种组织和展示信息的框架,它允许用户自定义和个性化他们的工作环境。在ExtJS中,"portal"通常指的是Portlet...
总的来说,理解并实现ExtJS Portal的拖放保持cookie功能,需要掌握ExtJS的DragDrop API、cookie管理和JavaScript编程。通过这种方式,开发者可以提供一个高度可定制且用户友好的Web应用,让用户享受到自定义布局的...
基于extjs框架实现的双日历功能
在这个"ExtJS实现聊天功能"的项目中,我们将探讨如何利用ExtJS框架构建一个类似于QQ的聊天应用程序。 首先,我们要理解聊天功能的核心要素。一个基本的聊天应用通常包含以下部分: 1. **用户界面**:ExtJS提供了...
综上所述,EXTjs4实现类似QQ消息提醒的功能主要依赖于其内置的提示组件,通过合理的配置和编程,可以创建出丰富多样的消息提醒效果。结合提供的资源文件,开发者可以深入理解并实践EXTjs4的通知系统。
在本文中,我们将深入探讨如何使用ExtJS来模拟Excel表格,以及实现Excel的各种功能。 首先,ExtJS中的GridPanel组件是实现模拟Excel表格的核心。GridPanel允许我们展示大量数据,并提供了诸如排序、过滤、分页等...
在标题提到的"Extjs搜索过滤 类似百度、google搜索"中,我们关注的是如何利用ExtJS实现一个高效的、类似百度或Google的搜索功能。这个功能通常涉及到实时数据过滤、模糊匹配、分页以及用户友好的交互设计。 首先,...
最近小弟做了Extjs实现实现下拉框联动的效果,参考了好久才学会,闲下来发一个简单的例子。。呵呵
Extjs Portal 拖拽并保存 多个实例,直接运行。
在"extjs portal 实例"中,我们主要关注的是Portal功能,它是ExtJS提供的一种灵活的布局方式,允许用户自定义和组织页面上的内容区域。 在ExtJS的示例中,"portal"通常是一个可配置的页面,用户可以自由地拖放各个...
在本文中,我们将探讨如何使用ExtJS框架配合Apache POI库来实现Excel的导出功能。ExtJS是一个强大的JavaScript库,专门用于构建富客户端应用程序,它提供了丰富的组件和功能,而无需关注后端技术。Apache POI是Java...
在本项目中,“extjs实现的带标签、翻页动画的书”显然利用了ExtJS的组件化特性和动画功能,创建了一个模拟真实书籍阅读体验的应用。 首先,我们来看看“标签”这一概念。在Web应用中,标签(Tab)通常用来组织和...
`classes`目录可能包含了自定义的JavaScript类文件,这些类可能扩展了ExtJS的内置组件,或者实现了特定的功能,比如自定义的Portlet行为、数据加载逻辑等。 总的来说,这个压缩包提供了一个基于ExtJS 4.2的Portal...
ExtJS 表格的功能实现,包括单元格编辑,数据的获取。
在“extjs实现增删查改”这个主题中,我们将探讨如何使用ExtJS来实现基本的数据操作功能。 首先,增删查改(CRUD,Create, Read, Update, Delete)是任何数据管理应用的核心功能。在ExtJS中,我们可以利用Grid ...
在树形组件中,虽然没有内置的分页支持,但我们可以通过自定义扩展来实现类似的功能。 要实现分页树,我们需要做以下几步: 1. **数据模型**:创建一个数据模型(Ext.data.Model),定义树节点的数据结构,包括...
在ExtJS中,这种功能主要通过`Ext.tree.TreePanel`或其现代版本`Ext.tree.View`来实现。 一、ExtJS 动态树基础 1. `Ext.tree.TreePanel`:这是ExtJS中用于创建树形结构的主要组件。它具有丰富的配置项和事件,支持...
在用户管理场景下,ExtJS可以用于创建表格展示用户信息,表单用于输入和编辑用户数据,以及各种按钮实现添加、删除和更新用户的功能。 在这个项目中,ExtJS4.2可能是通过AJAX技术与SpringMVC的后端进行通信,发送...