I am creating a asp.net mvc application and loaded the data into jqgrid and have paging and sorting working completely. I am trying to implement searching and have implemented code to display the search window; but when I click the Find button, I am unable to retrieve the searchString, searchField and searchOper since they are returned as empty. I am sure that I need to implement postdata code in the javascript but having trouble implementing one. Can anyone point me in the right direction?
Also, any idea about how to implement searching in the controller action??
This is what I have currently in the javascript:
<script type="text/javascript">
$(function () {
$("#list").jqGrid({
url: '/Home/GetData/',
datatype: 'json',
mtype: 'GET',
colNames: ['ID', 'NAME'],
colModel: [
{ name: 'ID', index: 'ID', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} },
{ name: 'NAME', index: 'NAME', width: 250, align: 'center', searchoptions: { sopt: ['eq', 'ne', 'cn']} }],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 30, 40, 50],
sortname: 'ID',
sortorder: "desc",
viewrecords: true,
height: '100%'
});
$("#list").jqGrid('navGrid', '#pager', { edit: true, add: true, del: true, search: true},
{},
{},
{},
{closeOnEscape: true, multipleSearch: true, closeAfterSearch: true},
{});
});
</script>
Any help is greatly appreciated!