Thanks for your repliy!
Actully,I have two tabs and a grid container on a WebForm,The two tabs are stand for users gender,one is Male,and anthor is Female,when i click the "Male" tab,i hope get user's info who's gender is Male,and when i switch to the "Female" tab,i want to get user's info who's gender is Female.
That means i must change paramter's value and send it to server to get what i want.Now my situation is that i tried the method that you suggested me to use the option of postData and send it,but i having not any luck,the grid load data only once...,when i change and click other tab,my call can never reaching the server.
What i want is that when i switch these tabs,grid can send request to server just like the grid's paging function.I also get some info from
http://paramquery.com/pro/tutorial,it seems that i must use the mehtod named "refreshDataAndView" if i want to reload data from server(loction='romote').And i also tried it in v1.1.3 and it did,so I was really confused,does PqGrid no longer supported this situation in v2.0.4 ? Or any other way i can use to solve my problem ?
Here is my JS code:
function ListGrid(obj) {
var _sex=obj;
//paramters
var _postData = {"Sex": _sex };
//url
var _url = "UserInfo.aspx?action=GridBindList";
//colM:grid title
var _colM = [
{ title: "UserID", width: 100, dataType: "integer", dataIndx: "UserID" },
{ title: "UserName", width: 100, dataType: "string", dataIndx: "UserName" },
{
title: "Sex", width: 150, dataType: "integer", dataIndx: "Sex",
render: function (ui) {
var rowData = ui.rowData;
var value = rowData["Sex"];
if (value == "0") {
return "Female";
}
else{
return "Male";
}
}
}
];
PQLoadGrid("#grid_paging", _url, _colM, _postData, 20);
}
/*
a function that it is used to get data into PQ grid from server
obj_ID:Container ID
*/
function PQLoadGrid(obj_ID, _url, _colM, _postData, _pageSize) {
var dataModel = {
location: "remote",
paging: "remote",
dataType: "JSON",
method: "GET",
postData: _postData,
url: _url + "&a=" + new Date(),
getData: function (dataJSON, textStatus, jqXHR) {
return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data };
}
}
var grid = $(obj_ID).pqGrid({
width: 900,
height: 400,
collapsible: false,
dataModel: dataModel,
colModel: _colM,
freezeCols: 0,
wrap: true,
hwrap: false,
numberCell: { resizable: true, width: 30, title: "No" },
oddRowsHighlight: true,
columnBorders: true,
pageModel: { type: "remote", rPP: _pageSize, rPPOptions: [20, 50, 100] },//, strRpp: "{0}",
editable: false
});
}
And html code as below:
<div onclick="ListGrid(0)">Female</div>
<div onclick="ListGrid(1)">Male</div>
<div id="grid_paging" style="margin-top: 1px;"></div>
Looking forward to your reply !