View Full Version : Stuck - MVC Application Architecture guide does not save to server

31 Dec 2011, 7:06 PM
I've run through the "MVC Application Architecture" guide very carefully, several times. I get the correct console messages and results as the guide progresses up to a certain point.

It stops working as described in the guide when I get to the "Saving to the Server" section. That is, the updateUsers.json data file does not have the expected dummy success response - the file is empty. The last entry in Chrome's network log is "dirty.gif" and not "updateUsers.json" as in the guide.

I added a console message to the updateUser function to make sure the code was being executed. It seems as if the "this.getUsersStore().sync();" line is not doing anything.

I would really like to have success with this guide before moving to the next step. Any gurus that can help?

1 Jan 2012, 12:24 AM
Can you post some of your source code. so we can walk through it and figure where is a problem. Mainly I'm interested in how did you define a store

1 Jan 2012, 3:55 AM
Sure, here is my app\store\Users.js

Ext.define('AM.store.Users', {
extend: 'Ext.data.Store',
model: 'AM.model.User',
autoLoad: true,

proxy: {
type: 'ajax',

api: {
read: 'data/users.json',
update: 'data/updateUsers.json'
reader: {
type: 'json',
root: 'users',
successProperty: 'success'

and my app/controller/Users.js:

Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
stores: ['Users'],
models: ['User'],

views: [

init: function() {
'viewport > userlist': {
itemdblclick: this.editUser
'useredit button[action=save]': {
click: this.updateUser

editUser: function(grid, record) {
var view = Ext.widget('useredit');


updateUser: function(button) {
var win = button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();


If there's any other code you want, or there is a better way for me to post it, please let me know.

Screenshot of Chrome's debugger after updateUser function:


2 Jan 2012, 5:07 AM
Added code and screenshot. Still can't get the MVC Application Architecture guide to work as described. Anyone able to make it work?

2 Jan 2012, 5:19 AM
Can you put a breakpoint to

this.getUsersStore().sync(); and trace down what it is doing ?

2 Jan 2012, 6:41 AM
I found a solution. In the guide, there is a section called "Creating a Model and a Store". It describes how to edit app/view/user/List.js, as the guide says: "to simply reference the Store by id".

The guide was unclear how to edit List.js and in several attempts I did not edit it correctly. So, here is what I believe List.js should ultimately contain and which helped me get past my obstacle:

Ext.define('AM.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.userlist',

//we no longer define the Users store in the `initComponent` method
store: 'Users',

title : 'All Users',

initComponent: function() {
this.columns = [
{header: 'Name', dataIndex: 'name', flex: 1},
{header: 'Email', dataIndex: 'email', flex: 1}


9 Jan 2012, 9:41 AM
I have the exact same code as noted here but still don't see anything written to updateUsers.json.

11 Jan 2012, 9:51 AM
I have the exact same code as noted here but still don't see anything written to updateUsers.json.

Actually I had this problem also (nothing written to updateUsers.json), but I did not mention it. I did everything according to the tutorial and everything else worked as described except this last step. I still don't know why. Anyone else have this problem besides me and wxkevin?

14 Nov 2012, 7:04 AM
This thread is marked "Answered" - was it really? I got stuck on the same last step - updating updateUsers.json file. Another thread on the same topic (http://www.sencha.com/forum/showthread.php?246809) suggests that the file should not even get updated following just the tutorial's steps. Instead, you need to send the request to a script to do the update. So should it or should it not get updated iff one follows the tutorial?