这是我的JqGrid Ajax 函数:
function GetData() {
$.ajax({
type: "POST",
url: "../Downloads.aspx/GetDownLoadData",
contentType: "application/json; charset=utf-8",
dataType: "json",
//async: false,
success: function (response) {
debugger;
var item = response.d;
if (item != null && item != "" && typeof (item) != 'undefined') {
$("#list").jqGrid({
data: JSON.parse(item),
datatype: 'local',
colNames: ['DownLoad Name', 'Format','Size','Link',''],
colModel: [
{ name: 'DownLoadName', index: 'DownLoadName', width: 200, align: 'left', stype: 'text', editable: false },
{ name: 'Format', index: 'Format', width: 150, align: 'left', stype: 'text', editable: false },
{ name: 'Size', index: 'Size', width: 150, align: 'left', stype: 'text', editable: false },
{ name: 'Link', index: 'Link', width: 150, align: 'left', stype: 'text', editable: false },
{ name: 'Id', index: 'Id', width: 145, align: 'left', stype: 'text', editable: false,hidden:true }
],
rowNum: 5,
height:'auto',
altRows: true,
hoverrows:true,
rowList: [5, 10, 20],
pager: '#pager',
sortname: 'Id',
sortorder: 'asc',
caption: "DownLoad Data",
viewrecords: true,
loadonce: true,
gridview: true,
width:995,
loadError: function (xhr) {
alert("The Status code:" + xhr.status + " Message:" + xhr.statusText);//Getting reponse 200 ok
}
});
}
else {
var result = '<tr align="left"><td>' + "No Record" + '</td></tr>';
$('#list').empty().append(result);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("error");
}
});
}
它给了我完美的输出,但是在输出中,为什么滚动条出现在列标题中?我无法弄清楚。请帮助我。谢谢。 这是输出:
请参阅链接
列中所附图片和圆圈。
最佳答案
我建议您使用以下附加 CSS 规则来解决该问题:
.ui-jqgrid-hdiv { overflow-y: hidden; }
或
.ui-jqgrid .ui-jqgrid-hdiv { overflow-y: hidden; }
jqGrid 仅在 .ui-jqgrid-hdiv
上设置 overflow-x:hidden;
(请参阅 here )。因此,取决于所使用的其他 CSS 规则,可能会包含垂直滚动条。上面的 CSS 角色将其删除。
关于jquery - 滚动出现在 JqGrid 列的标题中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26083737/