ExtJS4网格赢得';更新远程数据库

ExtJS4网格赢得';更新远程数据库,extjs,grid,store,extjs4,Extjs,Grid,Store,Extjs4,出于某种原因,ExtJS4网格的这种配置不会更新。当您单击一个单元格,更改一个值时,它会点击创建URL,而不是更新URL,正如代理中定义的,并在FF4中使用Firebug观察到的那样。奇怪的是,datachanged事件是在页面启动时加载存储后触发的,而不是在数据实际更改后触发的。此外,网格会将所有行发送到创建URL 谁能告诉我我做错了什么 Ext.onReady(function() { Ext.BLANK_IMAGE_URL = '/images/extjs4/s.gif';

出于某种原因,ExtJS4网格的这种配置不会更新。当您单击一个单元格,更改一个值时,它会点击创建URL,而不是更新URL,正如代理中定义的,并在FF4中使用Firebug观察到的那样。奇怪的是,datachanged事件是在页面启动时加载存储后触发的,而不是在数据实际更改后触发的。此外,网格会将所有行发送到创建URL

谁能告诉我我做错了什么

Ext.onReady(function() {

    Ext.BLANK_IMAGE_URL = '/images/extjs4/s.gif';
    Ext.tip.QuickTipManager.init();
    //Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));

    Ext.define('VendorError', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'UnexpSrvID', type: 'int'},
            {name: 'VendorID', type: 'int'},
            {name: 'VendorName', type: 'string'},
            {name: 'VndActID', type: 'int'},
            {name: 'VndActNb', type: 'string'},
            {name: 'InvoiceID', type: 'int'},
            {name: 'VInvNb', type: 'string'},
            {name: 'VInvRcptDt', type: 'date', dateFormat: 'Y-m-d' },
            {name: 'InvDate', type: 'date', dateFormat: 'Y-m-d' },
            {name: 'CodeSpecifier', type: 'string'},
            {name: 'Recurrence', type: 'string'},
            {name: 'ClientID', type: 'int'},
            {name: 'ClientName', type: 'string'},
            {name: 'LocID', type: 'int'},
            {name: 'LocName', type: 'string'},
            {name: 'RecentLocStatus', type: 'string'},
            {name: 'RecentLocStatusDate', type: 'date', dateFormat: 'Y-m-d' },
            {name: 'UnexpCost', type: 'float'},
            {name: 'ConfirmedAmt', type: 'float'},
            {name: 'StaffID', type: 'int'},
            {name: 'NetworkID', type: 'string'},
            {name: 'UnexpStatCode', type: 'string'}
        ],
        proxy: {
            type: 'ajax',
            simpleSortMode: true,
            api: {
                read: '/internal/viewVERext_json.asp',
                create: '/internal/viewVERext_create.asp',
                update: '/internal/viewVERext_update.asp',
                destroy: '/internal/viewVERext_destroy.asp'
            },
            reader: {
                type: 'json',
                totalProperty: 'total',
                successProperty: 'success',
                messageProperty: 'message',
                root: 'data'
            },
            writer: {
                type: 'json',
                writeAllFields: false,
                allowSingle: false,
                root: 'data'
            },
            listeners: {
                exception: function(proxy, response, operation){
                    Ext.MessageBox.show({
                        title: 'REMOTE EXCEPTION',
                        msg: operation.getError(),
                        icon: Ext.MessageBox.ERROR,
                        buttons: Ext.Msg.OK
                    });
                }
            }
        }
    });

    var store = Ext.create('Ext.data.Store', {
        model: 'VendorError',
        autoLoad: true,
        autoSync: true,
        pageSize: 20,
        remoteSort: true,
        listeners: {
        //  write: function(proxy, operation){
        //      if (operation.action == 'destroy') {
        //          main.child('#form').setActiveRecord(null);
        //      }
        //      Ext.example.msg(operation.action, operation.resultSet.message);
        //  }
            datachanged: function() {
                var report = "";
                store.each( 
                    function(rec) { 
                        report = report + rec.dirty + '/';
                    } 
                )
                alert(report);
            }
        }
    });

    // create the Grid
    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        //stateful: true,
        //stateId: 'stateGrid',
        columns: [
            {   text     : 'Vendor',
                dataIndex: 'VendorName',
                flex     : 1
            },
            {   text     : 'Account',
                dataIndex: 'VndActNb'
            },
            {   text     : 'Invoice',
                dataIndex: 'VInvNb'
            },
            {   text     : 'Invoiced',
                dataIndex: 'InvDate', 
                xtype    : 'datecolumn',
                align    : 'center'
            },
            {   text     : 'Receipted',
                dataIndex: 'VInvRcptDt', 
                xtype    : 'datecolumn',
                align    : 'center'
            },
            {   text     : 'Description',
                dataIndex: 'CodeSpecifier'
            },
            {   text     : 'Client',
                dataIndex: 'ClientName'
            },
            {   text     : 'Location',
                dataIndex: 'LocName'
            },
            {   text     : 'LStatus',
                dataIndex: 'RecentLocStatus',
                align    : 'center'
            },
            {   text     : 'Credit',
                dataIndex: 'UnexpCost',
                tdCls    : 'colyellow',
                renderer : Ext.util.Format.usMoney,
                align    : 'right',
                field    : { xtype:'textfield', allowBlank:false }
            },
            {   text     : 'Confirmed',
                dataIndex: 'ConfirmedAmt',
                tdCls    : 'colyellow',
                renderer : Ext.util.Format.usMoney,
                align    : 'right',
                field    : { xtype:'textfield', allowBlank:false }
            },
            {   text     : 'Recurrence',
                dataIndex: 'Recurrence',
                tdCls    : 'colyellow',
                align    : 'center',
                field    : {
                    xtype    : 'combobox',
                    typeAhead: true,
                    triggerAction: 'all',
                    selectOnTab: true,
                    store: [
                        ['once','once'],['1st','1st'],['2nd+','2nd+']
                    ],
                    lazyRender: true
                }
            },
            {   text     : 'CStatus',
                dataIndex: 'UnexpStatCode',
                tdCls    : 'colyellow',
                align    : 'center',
                field    : {
                    xtype    : 'combobox',
                    typeAhead: true,
                    triggerAction: 'all',
                    selectOnTab: true,
                    store: [
                        <%=cstat_grid%>
                    ],
                    lazyRender: true
                }
            },
            {   text     : 'Owner',
                dataIndex: 'NetworkID',
                tdCls    : 'colyellow',
                field    : {
                    xtype    : 'combobox',
                    typeAhead: true,
                    triggerAction: 'all',
                    selectOnTab: true,
                    store: [
                        <%=staff_grid%>
                    ],
                    lazyRender: true
                }
            }
        ],
        layout: 'fit',
        height: 500,
        renderTo: 'theGrid',
        selType: 'cellmodel',
        plugins: [
            Ext.create('Ext.grid.plugin.CellEditing', {
                clicksToEdit: 1
            })
        ],
        dockedItems: [
            {   xtype: 'pagingtoolbar',
                store: store,
                dock: 'bottom',
                displayInfo: true
            },
            {   xtype: 'toolbar',
                dock: 'top',
                items: [
                    { xtype:'button', 
                      text: 'IsDirty()', 
                      handler: function() { 
                        var report = "";
                        store.each( 
                            function(rec) { 
                                report = report + rec.dirty + '/';
                            } 
                        )
                        alert(report);
                        }
                    }
                ]
            }
        ],
        viewConfig: {
            stripeRows: true
        }
    });

    Ext.EventManager.onWindowResize(grid.doLayout, grid);
});
Ext.onReady(函数(){
Ext.BLANK_IMAGE_URL='/images/extjs4/s.gif';
Ext.tip.QuickTipManager.init();
//Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider');
Ext.define('vendoerror'{
扩展:“Ext.data.Model”,
字段:[
{name:'UnexpSrvID',键入:'int'},
{name:'VendorID',键入:'int'},
{name:'VendorName',键入:'string'},
{name:'VndActID',键入:'int'},
{name:'VndActNb',键入:'string'},
{name:'InvoiceID',键入:'int'},
{name:'VInvNb',键入:'string'},
{name:'VInvRcptDt',type:'date',dateFormat:'Y-m-d'},
{name:'InvDate',type:'date',dateFormat:'Y-m-d'},
{name:'code说明符',键入:'string'},
{name:'Recurrence',type:'string'},
{name:'ClientID',键入:'int'},
{name:'ClientName',键入:'string'},
{name:'LocID',type:'int'},
{name:'LocName',键入:'string'},
{name:'RecentLocStatus',键入:'string'},
{名称:'RecentLocStatusDate',类型:'date',日期格式:'Y-m-d'},
{name:'UnexpCost',键入:'float'},
{name:'ConfirmedAmt',键入:'float'},
{name:'StaffID',键入:'int'},
{name:'NetworkID',键入:'string'},
{name:'UnexpStatCode',键入:'string'}
],
代理:{
键入:“ajax”,
simpleSortMode:true,
api:{
阅读:'/internal/viewVERext_json.asp',
创建:'/internal/viewVERext_create.asp',
更新:'/internal/viewVERext_update.asp',
销毁:'/internal/viewVERext\u destroy.asp'
},
读者:{
键入:“json”,
totalProperty:'total',
successProperty:“成功”,
messageProperty:'消息',
root:“数据”
},
作者:{
键入:“json”,
writeAllFields:false,
allowSingle:false,
root:“数据”
},
听众:{
异常:函数(代理、响应、操作){
Ext.MessageBox.show({
标题:“远程异常”,
msg:operation.getError(),
图标:Ext.MessageBox.ERROR,
按钮:Ext.Msg.OK
});
}
}
}
});
var store=Ext.create('Ext.data.store'{
型号:“供应商错误”,
自动加载:对,
自动同步:对,
页面大小:20,
remoteSort:是的,
听众:{
//写入:函数(代理、操作){
//如果(operation.action=='destroy'){
//main.child('#form').setActiveRecord(null);
//      }
//Ext.example.msg(operation.action、operation.resultSet.message);
//  }
datachanged:函数(){
var报告=”;
商店。每个(
函数(rec){
报告=报告+rec.dirty+'/';
} 
)
警报(报告);
}
}
});
//创建网格
var grid=Ext.create('Ext.grid.Panel'{
店:店,,
//有状态的:是的,
//stateId:“stateGrid”,
栏目:[
{文本:'供应商',
数据索引:“VendorName”,
弹性:1
},
{文本:'帐户',
数据索引:“VndActNb”
},
{文本:'发票',
数据索引:“VInvNb”
},
{文本:'已开票',
数据索引:“InvDate”,
xtype:'datecolumn',
对齐:“居中”
},
{文本:'已接收',
数据索引:“VInvRcptDt”,
xtype:'datecolumn',
对齐:“居中”
},
{文本:“说明”,
数据索引:“代码说明符”
},
{文本:'客户端',
dataIndex:'ClientName'
},
{文本:'位置',
数据索引:“LocName”
},
{文本:'LStatus',
dataIndex:“RecentLocStatus”,
对齐:“居中”
},
{文本:'信用',
dataIndex:'UnexpCost',
tdCls:“colyellow”,
渲染器:Ext.util.Format.usMoney,
对齐:“右”,
字段:{xtype:'textfield',allowBlank:false}
},
{文本:'已确认',
数据索引:“确认数据”,
tdCls:“colyellow”,
渲染器:Ext.util.Format.usMoney,
对齐:“右”,
字段:{xtype:'textfield',allowBlank:false}
},
{文本:'重复',
dataIndex:'重复',
tdCls:“colyellow”,
对齐:'居中',
字段:{
xtype:“组合框”,
是的,
触发动作:“全部”,
selectOnTab:对,
s
listeners: {
    edit : function(e) {
        e.record.commit();
    }
}