Dear All,
I'm very new with JQGrid, so I apologize in advance if this a very 'duh' question..
The case is when I delete a row in the grid, jqgrid only pass the parameter id to the editurl. However, there are cases when I need more than one id parameter to delete a row, for instance for grid like this:
{UserID, Message} => {(user1, "hello"),(user1, "hola"),(user2,"hi")}
If i want to only delete the (user1, "hello") row, I need JQGrid to pass the parameter UserID=user1 and Message="hello" otherwise the (user1, "hello") and (user1, "hola") will be deleted.
I alreadt tried to modify the url before deleting by using onClickSubmit parameter:
onclickSubmit: function(rp_ge, postdata){
rp_ge.url = 'RowManipulator.php?UserID='+$('#grid').getCell(postdata, 'UserID')+
'&Message='+$('#grid').getCell(postdata,'Message');
However the resulted url (after checking on firebug) is:
RowManipulator.php?UserID=user1&Message=false
instead of RowManipulator.php?UserID=user1&Message="hello"
. It seems that the message paramater can't be delivered.
Does anyone have any idea how to achieve what I intended to? Any help will be very appreciated
Updated: Here is the jquery code:
jQuery(document).ready(function(){
jQuery("#list").jqGrid(
{ url:'DataFetcher.php',
datatype: 'xml',
mtype: 'GET',
colNames:['UserId','Message'],
colModel:[
{name:'UserId',index:'UserId',width:75, editable:false,align: 'left'},
{name:'Message',index:'Message',width:200, editable:true,align: 'left'}
],
pager: jQuery('#pager'),
rowNum:10,
rowList:[10,20,30],
sortname:'UserId',
sortorder: "asc",
viewrecords: true,
imgpath: 'jqgrid/css/images',
caption: 'MESSAGE',
editurl:'RowManipulator.php',
height: 350,
width: 1000});
jQuery("#list").jqGrid('navGrid','#pager',{},
{height:280,reloadAfterSubmit:true},
{height:280,reloadAfterSubmit:true},
{onclickSubmit: function(rp_ge, postdata){
rp_ge.url = 'RowManipulator.php?UserId='
$('#list').getCell(postdata, 'UserId') &&
Message=$('#list').getCell(postdata,Message);
},
reloadAfterSubmit:true},
{sopt:['cn','eq']})