如何在extjs中更改PayPal按钮的金额值?



我把PayPal按钮放在容器的渲染后事件中,但问题是金额值在那一点是固定的,我不知道如何改变这个值。那么,值('88.44')如何在EXTJS中动态更改?

listeners:{

afterrender: function (){
paypal.Buttons({
// Set up the transaction
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '88.44'
}
}]
});
},
// Finalize the transaction
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Show a success message to the buyer
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}

}).render('#paypal-button-container');
}
}
value: some_function_call_that_returns_value_you_want();

例如:

value: document.getElementById('amount').value;

最新更新