它不适用于searchFilter。我发送一些paramData到服务器端,然后服务器响应json数据。排序是有效的,但不能使用搜索。我尝试了很多时间pix这个问题,但我不知道如何。有人说searchFilter应该是dataType'local'。但我从服务器cuz收到json不能使用本地类型。如果有人知道如何pix这个让我知道如何更改代码,请!
这是我的脚本代码!
函数jqgridWrite(){
var param = $('#playerInfo').serialize();
$("#gridfield").empty();
var a = $("<table>").attr("id", "multiple");
var b = $("<div>").attr("id", "pmultiple");
$("#gridfield").append(a);
$("#gridfield").append(b);
jQuery("#multiple").jqGrid({
url:'playerGrid.do',
postData: param,
datatype: "json",
colNames:['이름','포지션','소속팀', '평점','출전시간','MoM','선발','교체','득점','도움',
'키패스','총슈팅','유효슈팅','프리킥','패널트킥','총패스','짧은패스','롱패스','크로스',
'쓰루패스','헤딩','드리블','볼터치','태클','반칙','피반칙','오프사이드','옐로우카드',
'레드카드'
],
colModel:[
{name:'playerName', index:'playerNamed', width:60, align:'center', search:true, sorttype:"text", key:true},
{name : 'playerPosition', width:80, align:'center' , formatter : function(cellValue,options,rowObject){
if(cellValue == 'CF'){
return '중앙공격수';
}else if(cellValue== 'ST'){
return '스트라이커';
}else if(cellValue== 'RWF'){
return '오른쪽윙포워드';
}else if(cellValue== 'LWF'){
return '왼쪽윙포워드';
}else if(cellValue== 'AM'){
return '공격형미드';
}else if(cellValue== 'CM'){
return '중앙미드';
}else if(cellValue== 'LM'){
return '왼쪽미드';
}else if(cellValue== 'RM'){
return '오른쪽미드';
}else if(cellValue== 'DM'){
return '수비형미드';
}else if(cellValue== 'LB'){
return '왼쪽수비수';
}else if(cellValue== 'RB'){
return '오른쪽수비수';
}else if(cellValue== 'CB'){
return '중앙수비수';
}else if(cellValue== 'LWB'){
return '왼쪽윙백';
}else if(cellValue== 'RWB'){
return '오른쪽윙백';
}else if(cellValue== 'GK'){
return '골키퍼';
}
}},
{name:'playerTeam', width:75, align:'center'},
{name:'playerRate', width:40, align:"center", sorttype:"number"},
{name:'playTime', width:70, align:"center", sorttype:"number"},
{name:'playerMom', width:40, align:"center", sorttype:"number"},
{name:'playerAppearance', width:30, align:"center", sorttype:"number"},
{name:'playerSubstitute', width:30, align:"center", sorttype:"number"},
{name:'score', width:30, align:"center", sorttype:"number"},
{name:'assist', width:30, align:"center", sorttype:"number"},
{name:'keyPass', width:40, align:"center", sorttype:"number"},
{name:'shotTotal', width:40, align:"center", sorttype:"number"},
{name:'onTarget', width:50, align:"center", sorttype:"number"},
{name:'freekick', width:40, align:"center", sorttype:"number"},
{name:'penalty', width:50, align:"center", sorttype:"number"},
{name:'passTotal', width:40, align:"center", sorttype:"number"},
{name:'shortPass', width:50, align:"center", sorttype:"number"},
{name:'longPass', width:40, align:"center", sorttype:"number"},
{name:'crossPass', width:40, align:"center", sorttype:"number"},
{name:'throughPass', width:50, align:"center", sorttype:"number"},
{name:'header', width:30, align:"center", sorttype:"number"},
{name:'dribble', width:40, align:"center", sorttype:"number"},
{name:'ballTouch', width:40, align:"center", sorttype:"number"},
{name:'tackle', width:30, align:"center", sorttype:"number"},
{name:'foul', width:30, align:"center", sorttype:"number"},
{name:'fouled', width:40, align:"center", sorttype:"number"},
{name:'offside', width:55, align:"center", sorttype:"number"},
{name:'yellowCard', width:55, align:"center", sorttype:"number"},
{name:'redCard', width:50, align:"center", sorttype:"number"}
],
page: 1,
rowNum:2,
rownumbers: true,
rowList:[10,20,30],
height:"100%",
width:1855,
pager: '#pmultiple',
sortname: 'playerRate',
mtype:"POST",
gridview: true,
viewrecords: true,
sortorder: "desc",
loadonce: true,
caption: "선수기록",
jsonReader : {repeatitems:false},
loadComplete: function () {
jQuery("#multiple").jqGrid({datatype: "local"});
}
});
$('#multiple').navGrid("#pmultiple", {
search: true, // show search button on the toolbar
add: false,
edit: false,
del: false,
refresh: true
},
{}, // edit options
{}, // add options
{}, // delete options
{ multipleSearch: true } // search options - define multiple search
);
}