ExtJs - 基本形式:是否可以将 params key 设为变量?
ExtJs - Basic form: Is it possible to make params key a variable?
myFormPanel.getForm().submit({
clientValidation: true,
url: 'updateConsignment.php',
params: {
newStatus: 'delivered'
},
success: function(form, action) {
},
failure: function(form, action) {
}
}
});
在上面的代码中,是否可以设置一个变量作为参数键?例如,如果我有以下变量:
var myVar = 'newStatus';
把变量作为param key,结果会一样吗?或者它只是将变量作为字符串从而使键成为 'myVar'?
可以通过以下方式赋值给请求中的params:
var formParams={};
var myVar='newStatus';
formParams[myVar]='delivered';
console.log(formParams);
myFormPanel.getForm().submit({
clientValidation: true,
url: 'updateConsignment.php',
params: formParams,
success: function(form, action) {
},
failure: function(form, action) {
}
}
});
myFormPanel.getForm().submit({
clientValidation: true,
url: 'updateConsignment.php',
params: {
newStatus: 'delivered'
},
success: function(form, action) {
},
failure: function(form, action) {
}
}
});
在上面的代码中,是否可以设置一个变量作为参数键?例如,如果我有以下变量:
var myVar = 'newStatus';
把变量作为param key,结果会一样吗?或者它只是将变量作为字符串从而使键成为 'myVar'?
可以通过以下方式赋值给请求中的params:
var formParams={};
var myVar='newStatus';
formParams[myVar]='delivered';
console.log(formParams);
myFormPanel.getForm().submit({
clientValidation: true,
url: 'updateConsignment.php',
params: formParams,
success: function(form, action) {
},
failure: function(form, action) {
}
}
});