日期:2014-05-16  浏览次数:20409 次

EXTJS MVC 使用AjaxProxy与“api”配置选项来支持不同store Url的读取和修改
我用EXTJS4的mvc模式开发,现在要修改grid的某一行提交到后台,
可是出现这个错误:uncaught exception: You are using a ServerProxy but have not supplied it with a url.

JScript code

//store/Users.js
Ext.define('ERP.store.Users', {
    extend: 'Ext.data.Store',
    model: 'ERP.model.User',
    autoLoad: false,
    pageSize: 15,
    autoSync: true,
    proxy: {
        type: 'ajax',
        api: {
            read: '/User/Search',
            update: '/User/SaveUser'
        },
        reader: {
            type: 'json',
            root: 'rows',
            totalProperty: 'totalCount',
            successProperty: 'success'
        }
    },
    initComponent: function() {
        this.callParent();
    }
    
});

//controller/User.js
Ext.define('ERP.controller.User', {
    extend: 'Ext.app.Controller',
    stores: ['Users'],
    models: ['User'],
    views: ['user.Portal', 'user.List', 'user.Edit'],
    init: function() {
        // console.log('Initialized User! This happens before the Application launch function is called');
        this.control({
            'userlist': {
                itemdblclick: this.editUser
            },
            'useredit button[action=save]': {
                click: this.updateUser
            },
            'userportal button[action=hello]': {
                click: this.hello
            }
        });
    },
    editUser: function(grid, record) {
        var view = Ext.widget('useredit');
        view.down('form').loadRecord(record);
    },
    updateUser: function(button) {
        console.log('Click the save button');

              var win = button.up('window'),
                    form = win.down('form'),
                    record = form.getRecord(),
                    values = form.getValues();
               record.set(values);

                this.getUsersStore().sync(); //这里应该跳到store的update:/User/SaveUser
        //       // this.getStore('Users').sync();//同步
                win.close();
    },
    hello: function(button) {
        alert('hello');
    }
});



我在参考网站上看了,也没有成功。
<a href="http://www.sencha.com/forum/archive/index.php/t-131152.html?s=4a9332c6e5527165d7eea2c108beb981">参考地址</a>

------解决方案--------------------
这个问题我爱莫能助~~我只能尽一下回帖的义务吧 ^_^
------解决方案--------------------
你的update后面是个action吗?