sion_eden
15 Feb 2012, 7:56 PM
This is the example in MVC Arcthitecture of EXTJS4 document and I get a error when I run it. Here is my code.
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
read: 'users.json',
update: 'updateUsers.json'
},
reader: {
type: 'json',
root: 'users',
successProperty: 'success'
}
}
});
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
views: ['user.List', 'user.Edit'],
stores: ['Users'],
models: ['User'],
init: function() {
this.control({
'userlist': {
itemdblclick: function(grid, record) {
var view = Ext.widget('useredit');
view.down('form').loadRecord(record);
}
},
'useredit button[action=save]': {
click: function(button) {
var win = button.up('window');
var form = win.down('form');
form.getRecord().set(form.getValues());
win.close();
this.getUsersStore().sync();
}
}
});
}
})
It load successful but when I edit and save, I get a error:Uncaught Ext.Error: You are using a ServerProxy but have not supplied it with a url
Thanks!!!
Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,
proxy: {
type: 'ajax',
api: {
read: 'users.json',
update: 'updateUsers.json'
},
reader: {
type: 'json',
root: 'users',
successProperty: 'success'
}
}
});
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
views: ['user.List', 'user.Edit'],
stores: ['Users'],
models: ['User'],
init: function() {
this.control({
'userlist': {
itemdblclick: function(grid, record) {
var view = Ext.widget('useredit');
view.down('form').loadRecord(record);
}
},
'useredit button[action=save]': {
click: function(button) {
var win = button.up('window');
var form = win.down('form');
form.getRecord().set(form.getValues());
win.close();
this.getUsersStore().sync();
}
}
});
}
})
It load successful but when I edit and save, I get a error:Uncaught Ext.Error: You are using a ServerProxy but have not supplied it with a url
Thanks!!!