栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

jqgrid json阅读器,用于arcgis服务器查询结果

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

jqgrid json阅读器,用于arcgis服务器查询结果

您遇到了奇怪的问题,以及有关一切的问题

jsonReader
。在当前情况下,您可以使用

jsonReader: {    root: 'features',    repeatitems: false}

读取数据。该演示展示了结果如何:

更新 :据我了解,您真正想要做的是调用一些 外部
URL,这些URL为您提供JSON。由于安全原因,无法对另一台服务器执行标准Ajax请求(请参阅同一原始策略)。幸运的是,服务器

sampleserver1.arcgisonline.com/ArcGIS
支持JSONP请求。因此,要使用外部数据填充网格,可以使用以下代码

$('#grid').jqGrid({    url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/4/query',    datatype: 'jsonp',    postdata: $.param({        where: "1=1",        returnGeometry: false,        outFields: "ObjectID,NAME,STATE_NAME,CNTY_FIPS",        f: "json"    }),    colModel: [        {name: 'ObjectID', label: 'ID', width: 60, jsonmap: 'attributes.ObjectID'},        {name: 'NAME', label: 'Name', width: 150, jsonmap: 'attributes.NAME'},        {name: 'STATE_NAME', label: 'State', width: 120, jsonmap: 'attributes.STATE_NAME'},        {name: 'CNTY_FIPS', label: 'FIPS', width: 60, jsonmap: 'attributes.CNTY_FIPS'}    ],    toppager: true,    jsonReader: {        root: 'features',        repeatitems: false    },    loadonce: true,    ignoreCase: true,    height: 'auto'});

在此处查看新的演示。

更新2 :为了能够使用本地搜索/过滤,应该修改上面的代码。最好

postData
将上面看到的替换为以下参数

ajaxGridOptions: { cache: true },prmNames: {search: null, nd: null, sort: null, rows: null, order: null, page: null},postdata: {    where: "1=1",    returnGeometry: false,    outFields: "ObjectID,NAME,STATE_NAME,CNTY_FIPS",    f: "json"}

请参阅相应的演示在哪里

filterToolbar
工作。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/449244.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号