store.sync失败后如何回调?

时间:2013-12-09 07:05:30

标签: javascript ajax extjs

    function onButtonClick(){
               var grid = Ext.getCmp('mygridpanel')
               var row = grid.getSelectionModel().getSelection()[0];
               var txtVehicleID = Ext.getCmp('txtVehicleID').getValue();
               var txtPlat_No = Ext.getCmp('txtPlat_No').getValue();
               console.log(txtVehicleID);

                var record = UserStore.findRecord('_id', txtVehicleID);
                record.set('_id', txtVehicleID);
                record.set('Plat_No',txtPlat_No);

                UserStore.sync({
                    success: function(batch) {
                                Ext.MessageBox.show({
                                    title: "Information",
                                    msg: batch.operations[0].request.scope.reader.jsonData["message"],
                                    icon: Ext.MessageBox.INFO,
                                    buttons: Ext.MessageBox.OK,
                                    fn: function(buttonId) {
                                        if (buttonId === "ok") {
                                            EditWin.close();
                                        }
                                    }
                                });  
                    },
                        failure: function(batch){
                                       Ext.MessageBox.show({
                                    title: "Error",
                                    msg: batch.operations[0].request.scope.reader.jsonData["message"],
                                    icon: Ext.MessageBox.ERROR,
                                    buttons: Ext.MessageBox.OK,
                                    fn: function(buttonId) {
                                        if (buttonId === "ok") {
                                                // Call back at here
                                    EditWin.close();
                                        }
                                    }
                        });  

                    }
                });
                //console.log("clicked");
    }

store.sync失败后如何回调?

1 个答案:

答案 0 :(得分:1)