I have simple JqGrid
$j("#gridTemp").jqGrid({
jsonReader: {
id: 'AppID' + 'Name',
repeatitems: false
},
url: GetData,
datatype: "json",
colNames: ['Col1', 'Col2'],
colModel: [
{ name: 'Col1'},
{ name: 'Col2'}
],
rowNum: 10,
autowidth: true,
rowList: [10, 20, 30],
pager: '#pager1',
}).navGrid('#pager1', { edit: false, add: false, del: true, search: false }, {}, {}, { url: DeleteAddress });
}
and trying to get delete button click event
$j('#del_gridTemp').click(function () {
alert($j('#gridTemp').jqGrid('getGridParam', 'selarrrow'));
});
for some reason its not working. Any help appriciated.
I don’t know what is the error, but I hope the demo will help you.
First you use
selarrrowparameter, so I suppose you want to have multiselect grid. So I addedmultiselect: trueparameter in the code. You original code with$('#del_gridTemp').click(function () {...});works in my demo. I modified just the text of the alerts. If you for example select rows having “test4”, “test2”, “test12” you will see first the message likeafter you click “OK” button and then “Delete” button in the confirmation dialog you will see the next message
from the onclickSubmit callback function which I recommend you to use. To code looks like
Inside of
onclickSubmitmethod I show additionally how to append the information which will be sent with additional information.I don’t have any server code under the URL ‘/DeleteAddress’, but in any tools like Fiddler of Firebug you will be able to the the format of data which will be posted. It’s the data in x-www-form-urlencoded form:
which are in decoded form:
I think it should be close to what you need.