4

私は grails 2.1.0 と extjs 4.1.0 を使用しています。ここで、成功方法でいくつかの問題に直面しています。問題は、以下のコードのコメントにあります。誰でもこれについて私を助けることができます:

 onupdateOrder : function(invoiceid, payMethod, rebatevalue){        
    if(invoiceid > 0){
        Ext.Msg.confirm('Update Product', 'Are you sure?', function (button) {
            if (button == 'yes') { 
                var invoice = Ext.create('Ext4Example.model.Invoice',{
                    id        : invoiceid,
                    rebate    : rebatevalue,
                    paymethod : payMethod
                });

                invoice.save({
                    success: function(model) {
                        var inId = model.getId();
                        this.updateOrder(invoiceid); //warning:this.updateOrder is not a function 
                    },
                    failure: function(){                           
                        console.log('Unable to save/update');
                    }
                });
            }
        }, this);
    }else{
        Ext.Msg.alert("Please Give Invoice Id");
    }
},
updateOrder :function(invoiceid){         
    var order = Ext.create('Ext4Example.model.Order',{
        id  : invoiceid
    });
    order.save({
        success: function(order) {
            console.log(invoiceid);
            Ext.getCmp('InvoiceNo').setValue(invoiceid);
            Ext.getCmp('itemform2').restoreItem();
        },
        failure: function(){
            console.log('Unable to update');
        }
    });
}
4

1 に答える 1

3

指定する必要があります

scope: this

コールバックがコントローラ スコープで実行されるように、invoice.save() メソッドで。

于 2012-11-28T04:57:43.173 に答える