gpt4 book ai didi

javascript - jqgrid 不加载所有行

转载 作者:行者123 更新时间:2023-12-03 08:30:53 24 4
gpt4 key购买 nike

我使用了以下内容:ASP .Net 2008 3.5 Webforms/Teradata 数据库。使用浏览器:IE 9、Firefox

我最多可以加载 1700 行,但不能加载全部 2000 多条记录。没有返回错误请帮我解决这个问题。如果我错过了以下任何引用和代码,请提出建议:

<link href="CSS/jquery-ui-1.9.2.custom.css" rel="stylesheet" type="text/css" />
<link href="CSS/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<script src="Script/jquery-1.8.3.js" type="text/javascript"></script>
<script src="Script/jquery-ui-1.9.2.custom.js" type="text/javascript"></script>
<script src="Script/grid.locale-en.js" type="text/javascript"></script>
<script src="Script/jquery.jqGrid.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript" >
$(function() {
$("#dataGrid").jqGrid({
url: 'UploadHistory.aspx/DisplayListToJQGrid',
datatype: 'json',
mtype: 'POST',
serializeGridData: function(postData) {
return JSON.stringify(postData);
},
ajaxGridOptions: { contentType: "application/json; charset=utf-8" },
colNames: ['Liability', 'Channel_Lvl_2_Desc'],
colModel: [
{ name: 'Liability', index: 'Liability', width: 300 },
{ name: 'Channel_Lvl_2_Desc', index: 'Channel_Lvl_2_Desc', width: 200 },
//{ name: 'T_ADDS', index: 'T_ADDS', width: 200 }
],
pager: '#pagingGrid',
rowNum: 10,
rowList: [10, 20, 100],
viewrecords: true,
gridview: true,
width: 780,
rownumbers: true,
loadonce: true,
jsonReader: {
page: function(obj) { return 1; },
total: function(obj) { return 1; },
records: function(obj) { return obj.d.length; },
root: function(obj) { return obj.d; },
repeatitems: false,
id: "0"
},
caption: 'Data List'
});
});
</script>




<WebMethod()> _
Public Shared Function DisplayListToJQGrid() As List(Of Dictionary(Of String, Object))

Return UploadClass.LoadListToJQGrid()

End Function

<WebMethod()> _
Public Shared Function LoadListToJQGrid() As List(Of Dictionary(Of String, Object))

Dim cmdQry As String = ""

cmdQry = "SELECT TOP 1970 Liability, Channel_Lvl_2_Desc FROM TABLENAME"

Return DataAccessClass.GetListFromDB(cmdQry)

End Function


<WebMethod()> _
Public Shared Function GetListFromDB(ByVal Sql As String) As List(Of Dictionary(Of String, Object))


Dim dt As New DataTable

Dim cmd As New Teradata.Client.Provider.TdCommand(Sql, DBConnectionClass.pTDConobj)
Dim da As New TdDataAdapter(cmd)
da.Fill(dt)

'Dim serializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer
Dim rows As New List(Of Dictionary(Of String, Object))()
Dim row As Dictionary(Of String, Object) = Nothing

For Each dr As DataRow In dt.Rows
row = New Dictionary(Of String, Object)()
For Each col As DataColumn In dt.Columns
row.Add(col.ColumnName.Trim(), dr(col).ToString())
Next
rows.Add(row)
Next

Dim serializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer()
serializer.Serialize(rows)

Return rows

End Function

最佳答案

我认为您有纯粹的服务器端问题。您使用返回 JSON 数据的 WebMethod。您可以通过在 web.config 中的相应位置添加诸如 jsonSerialization maxJsonLength="50000000"/> 之类的内容来增加限制。请参阅the answer了解更多详情。

我建议您在 jqGrid 中另外包含 loadError 回调,以查看诸如“使用 JSON JavaScriptSerializer 进行序列化或反序列化时出错。字符串长度超过 maxJsonLength 属性上设置的值”之类的错误。请参阅the old answer了解使用 loadError 回调的详细信息。

关于javascript - jqgrid 不加载所有行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33339103/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com