Recently using Jqgrid to develop an interface, very easy to use a framework, directly re-use the existing code, using GET request parameters, stitching behind the URL, encountered in the input box modified parameters after the background data is not acquired problems.
This problem has been tangled for a long while, by searching the Web page to understand that Jqgrid has triggers to reload data.
$ (' #Buttonid '). On (' click ', Function () { ///Page ' button ' click ' event, retrieve parameter after parameters are sent, and reload data.
keyword = $ ("#jjinputid"). Val (); Get the input box content
cchl= "Jijin";
$ ("#dataTable"). Jqgrid (' Setgridparam ', {
datatype: ' JSON ',
postdata:{' keyword ': encodeURI (encodeURI ( Keyword)},//Send data
page:1
}). Trigger ("Reloadgrid"); Reload
});
Here is the code to load the data, there are two important parameters, Mtype: ' POST ', define the request type, PostData define the parameter type
JQuery ("#dataTable"). Jqgrid ({
URL: ' rest/jjyqgk/getdata ',
editurl: ' Rest/tabconfig/edittab ',
DataType: "JSON",
mtype: ' POST ',
hidegrid:false,
colnames:
postdata: {
cchl:cchl,
keyword : Keyword
},
rownum:10,
rowlist:[10,20,30,40,50],
pager:jquery (' #pager '),
sortname: ' Id ',
viewrecords:true,
sortorder: "desc",
jsonreader: {
repeatitems:false,
ID: "0"
},
altrows:true,
///Altclass: ' SomeClass ',
rownumbers:true,
//caption: ' column list ',
width: Pagedoc.getwidth (),
height:pagedoc.getHeight ()
});
Reference pages: http://blog.csdn.net/enter89/article/details/8363189 http://www.huosen.net/archives/147.html