javascript - In jqgrid, how can I load data by condition? -
$("#list").jqgrid({ url: "assets/php/usermanager/user-read.php", datatype: "json", mtype: "get", colnames: ["userid", u, "user_group_id"], colmodel: [ { name: "userid", hidden: true }, { name: "username", width: 270, align: 'center', stype: 'text' }, { name: "user_group_id", hidden: true} ], height: "87%", pager: "#pager", rownum: 30, sortname: "userid", sortorder: "asc", viewrecords: true, gridview: true, autoencode: true, multiselect: true, caption: "user list" }); $(".ui-jqgrid-titlebar").hide(); $("#pager_right").hide(); $("#pager_center").width(220); $(".ui-pg-input").height(13); $("#list").navgrid( "#pager", { search: true, add: false, edit: false, del: false, refresh:true, searchoptions: {left: '30%'} }); $("#search_list").click(function(){ $("#searchmodfbox_list").css( "left", "30%" ); });
this jqgrid i'm using in code, , create buttons. need method or event jqgrid can click button , call method, load data data contain pattern.
for example, have button called "student", when click filter data role field student, grid show me students.
i figured out. after jqgrid loaded, can use set parameter grid , trigger reload refresh grid. has problem parameter 'groupid=1', search or filter won't work properly. fix problem, have set postdata nothing.
$("#list").setgridparam({'postdata' : 'groupid=1'}); $("#list").trigger("reloadgrid"); $("#list").setgridparam({'postdata' : {}});
Comments
Post a Comment