我有这个ajax请求,遍历存储并删除所有选定的记录。从商店删除记录与复选框选择
代码
Ext.Ajax.request({
url: 'system/index.php',
method: 'POST',
params: {
class: 'LicenseFeatures',
method: 'delete',
data: Ext.encode({
feature_id: (function(){
var e = "";
var sel = Ext.getCmp('featureGrid').getSelection();
var c = 0;
for(var i in sel) {
var x = (c == 0) ? e = sel[i].data.feature_id : e += "," + sel[i].data.feature_id;
c++;
}
return e;
})()
})
},
success: function(response){
Ext.MessageBox.alert('Status', 'Record(s) has been deleted.');
Ext.getStore('LicenseFeaturesStore').reload();
},
failure: function(){
Ext.MessageBox.alert('Status', 'Failed to delete records.');
}
});
目前的代码从电网获取1号并将其删除。我需要做的是从网格中获取两个Id,因为我需要将特定的sql运行到数据库。 sql需要两个输入,这里是sql
public function delete($vars){
$sql = "DELETE FROM `LicenseFeatures` WHERE feature_id in({$vars->data->feature_id}) AND license_id in({$vars->data->license_id})";
if($result = $vars->db->query($sql)) {
echo json_encode(array("success" => true,"sql"=>$sql));
} else {
echo json_encode(array("success" => false));
}
}
如果我没有解释清楚,请说出来 –
不太清楚你的意思。你在谈论你在sql查询中使用的license_id属性吗? – hansn
是的,我需要提交该属性以及feature_id属性 –