gpt4 book ai didi

jquery-ui - JQgrid:获取Json数据

转载 作者:行者123 更新时间:2023-12-04 16:54:40 26 4
gpt4 key购买 nike

当数据类型与列名一起位于本地时,有什么方法可以从Jqgrid获取完整的JSON数据吗?

采用以下格式:[{“firstname”:“Chris”},{“firstname”:“Dave”}]

最佳答案

您可以使用getRowData方法返回包含所有网格数据的数组。例如:

var fullData = jQuery("#myGrid").jqGrid('getRowData');

以下是jqGrid Wiki中 getRowData的文档,该文档有助于说明发生了什么:

getRowData


Parameters: rowid or none

Returns: array

Description:

Returns an array with data of the requested id = rowid. The returned array is of type name:value, where the name is a name from colModel and the value from the associated column in that row. It returns an empty array if the rowid can not be found.

If the rowid is not set the method return all the data from the grid in array



更新

您可能还对 data参数感兴趣,该参数可用于检索传递到网格的数据。从 the jqGrid docs:

An array that stores the local data passed to the grid. You can directly point to this variable in case you want to load an array data. It can replace the addRowData method which is slow on relative big data



For example:
var data = $('#' + gridid).jqGrid('getGridParam', 'data');

有帮助吗?

关于jquery-ui - JQgrid:获取Json数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11084066/

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