87,910
社区成员
发帖
与我相关
我的任务
分享
Ext.define('layoutApp.controller.LayoutController', {
extend : 'Ext.app.Controller',
views : ['TopView'],
stores : ['MenuTreeStore'],
init : function() {
this.control({
'viewport > panel[id=accorditionMenu]' : {
render : this.initMenu
},
'viewport > treepanel[id=menuTree]' : {
itemexpand : this.loadSubMenu,
cellclick : this.loadTab
}
});
},
loadTab : function(tab, td, cellIndex, record, tr, rowIndex, e,
eOpts) {
var text = record.raw.text;
var tabs = Ext.getCmp('tabpanel');
var tab = Ext.getCmp('' + text + record.raw.mid);
if (!tab) {
tabs.add({
title : text,
id : '' + text + record.raw.mid,
// html:'<iframe width="100%" border="0"
// frameborder="0" height="100%"
// src="html/resource.htm"></iframe>',
// icon:'路径',
loader : {
url :'html/resource.htm',
autoLoad : true,
scripts : true
}
});
}
tabs.setActiveTab(tab);
},
loadSubMenu : function(obj) {
var store = Ext.getCmp('menuTree').getStore();
store.getProxy().extraParams = {
'pid' : obj.raw.mid
};
},
initMenu : function() {
Ext.Ajax.request({
url : 'getMenu',
success : function(response) {
var text = response.responseText;
// alert(Ext.JSON.decode(text));
Ext.getCmp('accorditionMenu').add(Ext.JSON
.decode(text));
}
});
}
});
Ext.application({
name: 'resourceApp',
appFolder:'js/resource',
//controllers:['ResourceController'],
// views:['ResourceTreeGridView'],
launch: function() {
/* Ext.createWidget('resourcetreegrid', {
renderTo: 'resourceDiv'
});*/
Ext.create('Ext.grid.Panel', {
title: '这是资源表格',
columns: [
{ header: 'Name', dataIndex: 'name' },
{ header: 'Email', dataIndex: 'email', flex: 1 },
{ header: 'Phone', dataIndex: 'phone' }
],
bbar: [{
xtype: 'pagingtoolbar',
displayInfo: true
}],
renderTo: 'resourceDiv'
});
Ext.Msg.alert("提示","消息");
}
});
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>资源管理</title>
<link rel="stylesheet" type="text/css" href="jslib/ext4/resources/css/ext-all.css"/>
<script type="text/javascript" src="jslib/ext4/bootstrap.js"></script>
<script type="text/javascript" src="js/Contant.js"></script>
<script type="text/javascript" src="js/resourceApp.js"></script>
</head>
<body>
<div id="resourceDiv"></div>
</body>
</html>
m