jqGrid で行を削除する際に問題があります。
私の行は、email と idms_module という 2 つの主キーで構成されています。1 つの電子メールに 2 つ以上の idms_module を含めることができるため、これら 2 つのキーは行を削除するために必要です。
構文は次のとおりです。
jQuery("#grid-uac").jqGrid({
mtype:'GET',
url:'functions/get_useraccess.php',
editurl:'functions/edit_useraccess.php',
datatype: "JSON",
colNames:['User Email','Module Access','Level Access'],
colModel:[
{name:'user_email', width:300, editable:true, key:true},
{name:'module_access', width:550,editable:true, key:true,edittype:'select',editoptions:{dataUrl:'functions/get_modusracc.php'}},
{name:'level_access',width:100,editable:true,edittype:'select',editoptions:{value:"0:read only;1:read write"}}
],
loadComplete: function () {
alert("OK");
},
loadError: function (jqXHR, textStatus, errorThrown) {
alert('HTTP status code: ' + jqXHR.status + '\n' +
'textStatus: ' + textStatus + '\n' +
'errorThrown: ' + errorThrown);
alert('HTTP message body (jqXHR.responseText): ' + '\n' + jqXHR.responseText);
},
rowNum:10,
rowList:[5,10,15],
pager: '#pager-uac',
sortname: 'user_email',
viewrecords: true,
jsonReader: **{id: "user_email", id2 or some var : "module_access"}**,
sortorder: "asc",
gridview: true,
autoencode:true,
caption:"Inventory User Access Role"
});
たとえば、email: admin@test.com と idms_module: 6 で構成される行を削除したいとします。
PHPコードの一部は次のとおりです。
$email = $_REQUEST['id'];
$modules= $_REQUEST['another var'];
$query = DELETE FROM table WHERE email= $email AND module = $modules
ID からメールを正常に取得しましたが、「別の変数」を取得する方法についてのアイデアはありません