JQGrid jQuery UI MultiSelect小部件以及工具栏搜索在Internet Explorer中不起作用[8]
我正试图让它在InternetExplorer8中工作。它在Chrome中运行良好,但在InternetExplorer中,代码会以某种方式过滤掉这些行。如果我没有使用JSon数据并从示例中复制本地数据,那么一切似乎都很好。。。 我的目标浏览器是IE8,需要使用JSon数据,我使用的是JQgrid 4.4.1和multiselect 1.13.6。 非常感谢您的帮助:-) 更新 经过几次刷新后,它有时在IE中工作。它是否与JSon数据加载时间有关JQGrid jQuery UI MultiSelect小部件以及工具栏搜索在Internet Explorer中不起作用[8],jquery,json,internet-explorer,jqgrid,multi-select,Jquery,Json,Internet Explorer,Jqgrid,Multi Select,我正试图让它在InternetExplorer8中工作。它在Chrome中运行良好,但在InternetExplorer中,代码会以某种方式过滤掉这些行。如果我没有使用JSon数据并从示例中复制本地数据,那么一切似乎都很好。。。 我的目标浏览器是IE8,需要使用JSon数据,我使用的是JQgrid 4.4.1和multiselect 1.13.6。 非常感谢您的帮助:-) 更新 经过几次刷新后,它有时在IE中工作。它是否与JSon数据加载时间有关 <script type="text/ja
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.4.1/js/jquery.jqGrid.src.js"></script>
<script type="text/javascript">
var scannamenlijst = '@ViewBag.scannamenlijst';
//<![CDATA[
/*global $ */
/*jslint unparam: true, plusplus: true, browser: true */
$(function () {
$grid = $("#list"),
myDefaultSearch = "cn",
getColumnIndexByName = function (columnName) {
var cm = $(this).jqGrid('getGridParam', 'colModel'), i, l = cm.length;
for (i = 0; i < l; i += 1) {
if (cm[i].name === columnName) {
return i; // return the index
}
}
return -1;
},
modifySearchingFilter = function (separator) {
var i, l, rules, rule, parts, j, group, str, iCol, cmi, cm = this.p.colModel,
filters = $.parseJSON(this.p.postData.filters);
if (filters && filters.rules !== undefined && filters.rules.length > 0) {
rules = filters.rules;
for (i = 0; i < rules.length; i++) {
rule = rules[i];
iCol = getColumnIndexByName.call(this, rule.field);
cmi = cm[iCol];
if (iCol >= 0 &&
((cmi.searchoptions === undefined || cmi.searchoptions.sopt === undefined)
&& (rule.op === myDefaultSearch)) ||
(typeof (cmi.searchoptions) === "object" &&
$.isArray(cmi.searchoptions.sopt) &&
cmi.searchoptions.sopt[0] === rule.op)) {
// make modifications only for the 'contains' operation
parts = rule.data.split(separator);
if (parts.length > 1) {
if (filters.groups === undefined) {
filters.groups = [];
}
group = {
groupOp: 'OR',
groups: [],
rules: []
};
filters.groups.push(group);
for (j = 0, l = parts.length; j < l; j++) {
str = parts[j];
if (str) {
// skip empty '', which exist in case of two separaters of once
group.rules.push({
data: parts[j],
op: rule.op,
field: rule.field
});
}
}
rules.splice(i, 1);
i--; // to skip i++
}
}
}
this.p.postData.filters = JSON.stringify(filters);
}
},
dataInitMultiselect = function (elem) {
setTimeout(function () {
var $elem = $(elem), id = elem.id,
inToolbar = typeof id === "string" && id.substr(0, 3) === "gs_",
options = {
selectedList: 2,
height: "auto",
checkAllText: "all",
uncheckAllText: "no",
noneSelectedText: "Any",
open: function () {
var $menu = $(".ui-multiselect-menu:visible");
$menu.width("auto");
return;
}
},
$options = $elem.find("option");
if ($options.length > 0 && $options[0].selected) {
$options[0].selected = false; // unselect the first selected option
}
if (inToolbar) {
options.minWidth = 'auto';
}
$elem.multiselect(options);
$elem.siblings('button.ui-multiselect').css({
width: inToolbar ? "98%" : "100%",
marginTop: "1px",
marginBottom: "1px",
paddingTop: "3px"
});
}, 50);
};
$grid.jqGrid({
url: '/Stakeholder/getscanresponses/',
mtype: 'POST',
datatype: "json",
jsonReader: {
root: "rows", //array containing actual data
page: "page", //current page
total: "total", //total pages for the query
records: "records", //total number of records
repeatitems: false,
//id: "initiatiefid" //index of the column with the PK in it
},
colNames: ['Initiatief', 'Respondent', 'Scan', 'Datum'],
colModel: [
//{name:'id',index:'id',width:70,align:'center',sorttype: 'int'},
{ name: 'initiatiefnaam', index: 'initiatiefnaam', width: 165 },
{ name: 'respondentnaam', index: 'respondentnaam', width: 165 },
{
name: 'scannaam', width: 200, align: 'center', formatter: 'select',
edittype: 'select',
editoptions: {
value: scannamenlijst,
//defaultValue: 'Intime',
multiple: true
},
stype: 'select',
searchoptions: {
sopt: ['eq', 'ne'],
value: scannamenlijst,
attr: { multiple: 'multiple', size: 4 },
dataInit: dataInitMultiselect
}
},
{ name: 'responsedatum', index: 'responsedatum', width: 165, formatter: 'date', formatoptions: { srcformat: 'ISO8601Long', newformat: 'd/m/Y H:i:s' }, sorttype: 'date' }
],
rowNum: 20,
rowList: [5, 10, 20],
pager: '#pager',
loadonce: true,
gridview: true,
ignoreCase: true,
rownumbers: true,
sortname: 'responsedatum',
viewrecords: true,
sortorder: 'desc',
caption: "Scanrespondenten",
height: '100%',
beforeRequest: function () {
modifySearchingFilter.call(this, ',');
}
});
$grid.jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, search: false }, {}, {}, {}, {
multipleSearch: true,
multipleGroup: true,
recreateFilter: true
});
$grid.jqGrid('filterToolbar', { stringResult: true, searchOnEnter: true, defaultSearch: myDefaultSearch });
});
//]]>
</script>
var scannamenlijst='@ViewBag.scannamenlijst';
// 0) {
规则=过滤器。规则;
对于(i=0;i=0&&
((cmi.searchoptions==未定义| | cmi.searchoptions.sopt==未定义)
&&(rule.op==myDefaultSearch))||
(typeof(cmi.searchoptions)=“对象”&&
$.isArray(cmi.searchoptions.sopt)&&
cmi.searchoptions.sopt[0]==rule.op){
//仅对“包含”操作进行修改
parts=rule.data.split(分隔符);
如果(零件长度>1){
如果(filters.groups==未定义){
filters.groups=[];
}
组={
groupOp:'或',
组:[],
规则:[]
};
filters.groups.push(组);
对于(j=0,l=parts.length;j0&&$options[0]。选中){
$options[0]。selected=false;//取消选择第一个选定的选项
}
if(inToolbar){
options.minWidth='auto';
}
$elem.multiselect(选项);
$elem.sibbins('button.ui multiselect').css({
宽度:inToolbar?“98%:“100%”,
marginTop:“1px”,
marginBottom:“1px”,
paddingTop:“3px”
});
}, 50);
};
$grid.jqGrid({
url:“/涉众/getscanresponses/”,
mtype:“POST”,
数据类型:“json”,
jsonReader:{
root:“行”,//包含实际数据的数组
页面:“页面”,//当前页面
总计:“总计”,//查询的总页数
记录:“记录”,//记录总数
重复项:false,
//id:“initiatiefid”//包含PK的列的索引
},
colNames:['Initiatief'、'responder'、'Scan'、'Datum'],
colModel:[
//{名称:'id',索引:'id',宽度:70,对齐:'center',排序类型:'int'},
{名称:'initiatiefnaam',索引:'initiatiefnaam',宽度:165},
{name:'respondentanam',index:'respondentanam',宽度:165},
{
名称:'scannaam',宽度:200,对齐:'center',格式化程序:'select',
edittype:'选择',
编辑选项:{
值:scannamenlijst,
//defaultValue:'Intime',
多重:对
},
stype:'选择',
搜索选项:{
sopt:['eq','ne'],
值:scannamenlijst,
属性:{multiple:'multiple',大小:4},
dataInit:dataInitMultiselect
}
},