下面是我的extjs 4 MVC应用程序的根应用程序文件JavaScript文件。将ASP.NET体系结构与Sencha Ext JS MVC体系结构混合
我跟着这些指令准确,并使用IIS 7作为我的Web服务器:
http://docs.sencha.com/ext-js/4-1/#!/guide/application_architecture
并遵循这些说明配置IIS的框架:
http://www.sencha.com/forum/showthread.php?33266-Some-Problem-with-JSON&p=229858&viewfull=1#post229858
我想借一个ASP.NET用户控件(ascx文件)并将其添加到我的页面。它已经被注册了,但好像Sencha框架接管并忽略了我在页面中的内容。我只是将他们在MVC教程中使用的index.html文件作为一个aspx页面,并做了一些小的调整。我怎样才能让控制显示出来?如果这是不可能的,你建议我引用这个app.js文件(并重新命名它control_x.js代替app.js)的ASCX文件里,然后坚持用户控件(ASCX)和其他(目前不工作)到ASP.NET(aspx)页面?实质上,我不想依赖这个框架来完成我的整个应用程序,只是我不想构建自己的控件。
app.js:
Ext.application({
requires: ['Ext.container.Viewport'],
name: 'AM',
appFolder: 'app',
controllers: [
'Users'
],
launch: function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: {
xtype: 'userlist'
}
});
}
});
Users.js(控制器):
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
stores: [
'Users'
],
models: [
'User'
],
views: [
'user.List',
'user.Edit'
],
init: function() {
console.log('Initialized Users! This happens before the Application launch function is called');
this.control({
'viewport > panel': {
render: this.onPanelRendered
},
'viewport > userlist': {
itemdblclick: this.editUser
},
'useredit button[action=save]': {
click: this.updateUser
}
});
},
onPanelRendered: function() {
//console.log('The panel was rendered');
},
editUser: function(grid, record) {
//console.log('Double clicked on ' + record.get('name'));
var view = Ext.widget('useredit');
view.down('form').loadRecord(record);
},
updateUser: function(button) {
//console.log('clicked the Save button');
var win = button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();
record.set(values);
win.close();
// synchronize the store after editing the record
this.getUsersStore().sync();
}
});
这没有奏效。应用程序视图面板跨越整个浏览器窗口,即使放在ASP.NET用户控件中也是如此。现在,我发现了一种不同的方法,将视图和模型放入单独的控件中,并使用侦听器而不是控制器。 – MacGyver 2012-07-20 05:09:56