Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法在dojo dataGrid中显示查询的功能_Javascript_Datagrid_Dojo - Fatal编程技术网

Javascript 无法在dojo dataGrid中显示查询的功能

Javascript 无法在dojo dataGrid中显示查询的功能,javascript,datagrid,dojo,Javascript,Datagrid,Dojo,我正在创建一个web地图应用程序,用户将能够使用表单搜索查询图层特征(在本例中为土地属性),结果应以两种方式显示: 1) 符合搜索条件的酒店功能将在地图上突出显示(我有此功能) 2) 满足搜索条件的每个属性的属性将在dojo数据网格中列出。(我无法让它工作-我只是在我的dataGrid中收到一条错误消息“对不起,发生了一个错误” 任何建议都会很有帮助 查询表单html:(我认为这里没有任何问题) 采集编号: 物业名称: 物业类别: 访问站点 保护地役权 掠夺 鱼类孵化场 其他 什么 什么 WM

我正在创建一个web地图应用程序,用户将能够使用表单搜索查询图层特征(在本例中为土地属性),结果应以两种方式显示: 1) 符合搜索条件的酒店功能将在地图上突出显示(我有此功能) 2) 满足搜索条件的每个属性的属性将在dojo数据网格中列出。(我无法让它工作-我只是在我的dataGrid中收到一条错误消息“对不起,发生了一个错误”

任何建议都会很有帮助

查询表单html:(我认为这里没有任何问题)

采集编号:
物业名称:
物业类别:
访问站点
保护地役权
掠夺
鱼类孵化场
其他
什么
什么
WMA
WMU
所有者:
美国土地管理局
美国陆军工程兵团
县
爱达荷州鱼类和野味
爱达荷州土地部
爱达荷鱼类与野生动物基金会
爱达荷州运输部
私有的
作者
美国爱达荷大学
美国垦务局
美国林业局
美国鱼类野生动物服务局
权利类型:
协议书
掠夺
地役权
租赁
许可证
拥有
意志
英亩:
DojoDataGrid html:(不要认为这里有任何问题)

采集号
属性名
财产类型
土地所有者
权利类型
英亩
查询JavaScript(我相信问题在于最后一个代码块——“创建数据存储并绑定到网格”)。
函数doQuery(){
//初始化查询任务
var查询,queryTask;
var网格、存储;
queryTask=新的esri.tasks.queryTask(“https://fishandgame.idaho.gov/gis/rest/services/Data/IDFGManagedLands/MapServer/9");
//初始化查询
query=新的esri.tasks.query();
query.returnGeometry=true;
query.outFields=[“ACNO”、“Name”、“Land\u Type”、“Owner”、“ADM\u CODE”、“Acres”];
var theOwner=$(“#所有者选项:选中”).val();
//query.where=“Owner=”+所有者;
var theWhere=“Owner=”+theOwner+”;
//警报(theWhere);
query.where=theWhere;
执行(查询,显示结果);
}
函数showResults(结果){
//警报(结果、长度);
变量映射=_映射[0];
map.graphics.clear()
//突出显示已返回的功能。
var highlightSymbol=新的esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,新的dojo.Color([230,0,0]),1);
//以特征集的形式获取结果。
var featureSet=results.features;
//警报(featureSet.length);
//循环遍历返回的每个特性,提取属性,并将它们添加到项目数组中。
var items=[];//要存储在数据存储中的所有项

对于(var i=0,il=results.features.length;i您没有将商品分配到您的商店。我认为您的代码应该是这样的

store = new dojo.data.ItemFileReadStore({
  'identifier': 'OBJECTID_1',
  'label': 'OBJECTID_1',
  'items': items
})

唯一标识符OBJECTID_1不包括在原始查询中

将OBJECTID_1添加到query.outfields:

function doQuery() {
  //initialize query task
  var query, queryTask;
  queryTask = new esri.tasks.QueryTask("https://fishandgame.idaho.gov/gis/rest/services/Data/IDFGManagedLands/MapServer/9");

  //initialize query
  query = new esri.tasks.Query();
  query.returnGeometry = true;
  query.outFields = ["OBJECTID_1","ACNO", "Name", "Land_Type", "Owner", "ADM_CODE", "Acres"];

  var theOwner = $( "#Owner option:selected" ).val();
  //query.where = "Owner = " + theOwner;
  var theWhere = "Owner = '" + theOwner + "'";
  //alert(theWhere);
  query.where = theWhere;
  queryTask.execute(query, showResults);
}

function showResults(results) {
  var map = _maps[0];
  map.graphics.clear();

  //Highlight the features that have been returned.
  var highlightSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([230,0,0]),1);

  //Obtain the results in the form of a FeatureSet.
  var featureSet = results.features;

  //Loop through each of the features returned, pull out the attributes, and add them to the item array.
  var items = []; //all items to be stored in data store
  for (var i=0, il=featureSet.length; i<il; i++) {
                var graphic = featureSet[i];
                graphic.setSymbol(highlightSymbol);
                map.graphics.add(graphic);
                items.push(featureSet[i].attributes);
  }

  //Create data object to be used in store
  var data = {
    identifier: "OBJECTID_1", //This field needs to have unique values
    label: "OBJECTID_1",
    items:items
  };

  //Create data store and bind to grid.
  store = new dojo.data.ItemFileReadStore({ data:data });
  grid.setStore(store);
  hideLoading();
}
函数doQuery(){
//初始化查询任务
var查询,queryTask;
queryTask=新的esri.tasks.queryTask(“https://fishandgame.idaho.gov/gis/rest/services/Data/IDFGManagedLands/MapServer/9");
//初始化查询
query=新的esri.tasks.query();
query.returnGeometry=true;
query.outFields=[“OBJECTID_1”、“ACNO”、“Name”、“Land_Type”、“Owner”、“ADM_CODE”、“Acres”];
var theOwner=$(“#所有者选项:选中”).val();
//query.where=“Owner=”+所有者;
var theWhere=“Owner=”+theOwner+”;
//警报(theWhere);
query.where=theWhere;
执行(查询,显示结果);
}
函数showResults(结果){
变量映射=_映射[0];
map.graphics.clear();
//突出显示已返回的功能。
var highlightSymbol=新的esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,新的dojo.Color([230,0,0]),1);
//以特征集的形式获取结果。
var featureSet=results.features;
//循环遍历返回的每个特性,提取属性,并将它们添加到项目数组中。
var items=[];//要存储在数据存储中的所有项

对于(var i=0,il=featureSet.length;iDang)。这似乎并不能解决我的问题。我知道它通过map.graphics.add(graphics)正常工作,因为选定的功能在地图上高亮显示。我可以看到带有适当字段标签的网格,但它仍然没有填充选定的功能属性。我会继续。
    function doQuery() {
  //initialize query task
  var query, queryTask;
  var grid, store;
  queryTask = new esri.tasks.QueryTask("https://fishandgame.idaho.gov/gis/rest/services/Data/IDFGManagedLands/MapServer/9");

  //initialize query
  query = new esri.tasks.Query();
  query.returnGeometry = true;
  query.outFields = ["ACNO", "Name", "Land_Type", "Owner", "ADM_CODE", "Acres"];
  
  var theOwner = $( "#Owner option:selected" ).val();
  //query.where = "Owner = " + theOwner;
  var theWhere = "Owner = '" + theOwner + "'";
  //alert(theWhere);
  query.where = theWhere;
  queryTask.execute(query, showResults);
}

function showResults(results) {
  //alert(results.length);
  var map = _maps[0];
  map.graphics.clear()
  
  //Highlight the features that have been returned.
  var highlightSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([230,0,0]),1);
  //Obtain the results in the form of a FeatureSet.
  var featureSet = results.features;
  
  //alert(featureSet.length);
  
  //Loop through each of the features returned, pull out the attributes, and add them to the item array.
  var items = []; //all items to be stored in data store
  for (var i=0, il=results.features.length; i<il; i++) {
    var graphic = featureSet[i];
    graphic.setSymbol(highlightSymbol);
    map.graphics.add(graphic);
    items.push(featureSet[i].attributes);
  }  

  //Create data object to be used in store
  var data = {
  identifier: "OBJECTID_1", //This field needs to have unique values
  label: "OBJECTID_1",
  };
        
  //Create data store and bind to grid.
  store = new dojo.data.ItemFileReadStore({data: {items: data}});
  grid.setStore(store);
  //hideLoading(); 
}
store = new dojo.data.ItemFileReadStore({
  'identifier': 'OBJECTID_1',
  'label': 'OBJECTID_1',
  'items': items
})
function doQuery() {
  //initialize query task
  var query, queryTask;
  queryTask = new esri.tasks.QueryTask("https://fishandgame.idaho.gov/gis/rest/services/Data/IDFGManagedLands/MapServer/9");

  //initialize query
  query = new esri.tasks.Query();
  query.returnGeometry = true;
  query.outFields = ["OBJECTID_1","ACNO", "Name", "Land_Type", "Owner", "ADM_CODE", "Acres"];

  var theOwner = $( "#Owner option:selected" ).val();
  //query.where = "Owner = " + theOwner;
  var theWhere = "Owner = '" + theOwner + "'";
  //alert(theWhere);
  query.where = theWhere;
  queryTask.execute(query, showResults);
}

function showResults(results) {
  var map = _maps[0];
  map.graphics.clear();

  //Highlight the features that have been returned.
  var highlightSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([230,0,0]),1);

  //Obtain the results in the form of a FeatureSet.
  var featureSet = results.features;

  //Loop through each of the features returned, pull out the attributes, and add them to the item array.
  var items = []; //all items to be stored in data store
  for (var i=0, il=featureSet.length; i<il; i++) {
                var graphic = featureSet[i];
                graphic.setSymbol(highlightSymbol);
                map.graphics.add(graphic);
                items.push(featureSet[i].attributes);
  }

  //Create data object to be used in store
  var data = {
    identifier: "OBJECTID_1", //This field needs to have unique values
    label: "OBJECTID_1",
    items:items
  };

  //Create data store and bind to grid.
  store = new dojo.data.ItemFileReadStore({ data:data });
  grid.setStore(store);
  hideLoading();
}