0
我有一個非常好奇的錯誤或JQuery與JqGrid的錯誤。錯誤是當我嘗試在表格中顯示JSON中的數據時,如果向我顯示數據,如果表格未顯示超過20列並且具有超過200個數據,則代碼如下所示:JQGrid的JQuery表不能顯示信息
標題是:
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
<script type="text/ecmascript" src="jqGrid/js/i18n/grid.locale-en.js"></script>
<script type="text/ecmascript" src="jqGrid/js/jquery.jqGrid.min.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="jquery-ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" media="screen" href="jqGrid/css/ui.jqgrid.css" />
<!-- Continuacion de JqGrid-->
<!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- The link to the CSS that the grid needs -->
<link rel="stylesheet" type="text/css" media="screen" href="jqGrid/css/ui.jqgrid-bootstrap.css" />
的JS是:
<script>
$.jgrid.defaults.width = 780;
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<meta charset="utf-8" />
<div style="margin-left:20px">
<table id="jqGrid4"></table>
<div id="jqGridPager4"></div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#jqGrid4").jqGrid({
url: 'http://localhost/fileupload/api/Proveedor',
mtype: "GET",
styleUI : 'Bootstrap',
datatype: "JSON",
colModel: [
{ label: 'id', name: 'id', key: true, width: 75 },
{ label: 'Name', name: 'Name', width: 150 },
{ label: 'RFC', name: 'RFC', width: 150 },
{ label: 'Company Name', name: 'CompanyName', width: 150 },
{ label:'DateCreation', name: 'DateCreation', width: 150 }
],
viewrecords: true,
height: 250,
rowNum: 20,
pager: "#jqGridPager4",
sortable: true
});
});
</script>
在你可以看到,該表只顯示20行的形象,但我有207行。我需要箭頭移動並顯示更多行,但我不能。有任何想法嗎?我不想放rownum:+20或更多,因爲我不喜歡那個,我需要用箭頭移動,但是我不能。
如何查看'/ fileupload/api/Proveedor'的響應?你是否在服務器上實現了*服務器端分頁*或者服務器一次返回所有207行,並且你想使用*客戶端分頁*?在最後一種情況下,您應該添加'loadonce:true'選項。 – Oleg
這是!!!!!! @ Oleg非常感謝! –
歡迎您!我寫了與答案相同的信息。通過[接受](http://meta.stackexchange.com/a/5235/147495),您的答案將會提高您的聲譽。 – Oleg