您好!您应该想实现的是数据的遍历输出后至表格里吧,这里有我自己写的一段js便利输出的代码供您参考:
function processCompleted(queryEventArgs){
var result = queryEventArgs.result;
if (result && result.totalCount>0) {
var resultTable="";
for (var i =0;i<result.recordsets.length;i++) {
if (result.recordsets[i].features) {
var arrFields = new Array();
var intFieldCount=result.recordsets[i].fields.length;
resultTable +="<table id='datatable' align='left' style='position:relative;width:300px;height:200px;overflow-y:auto;' border='1'>";
var strTableHead="";
for(var n=0;n<intFieldCount;n++)
{ var fieldName=result.recordsets[i].fields[n];
strTableHead +="<td>";
strTableHead +=fieldName;
arrFields.push(fieldName);
}
strTableHead +="<td>";
strTableHead +="<input type='button' value='clear' >";
resultTable +="<tr>"+strTableHead+"</tr>";
for(var k=0;k<result.recordsets[i].features.length;k++)
{ var point = result.recordsets[i].features[k].geometry,
size = new SuperMap.Size(22, 20),
offset = new SuperMap.Pixel(-(size.w / 2), -size.h),
icon2 = new SuperMap.Icon("../theme/images/marker-gold.png", size, offset);
var feature=new SuperMap.Feature.Vector();
feature=result.recordsets[i].features[k];
var marker=new SuperMap.Marker(new SuperMap.LonLat(point.x, point.y), icon2);
marker.chao=feature;
markerLayerSQL.addMarker(marker);
marker.events.on({//注册点击事件的处理方法
"mouseover":openInfoWin,
"mouseout": setTimeout111,
"scope": marker
});
resultTable += "<tr>";
for(var j=0;j<intFieldCount;j++){
resultTable +="<td>";
resultTable += feature.attributes[arrFields[j]];
if (j%2==1){
resultTable +="<td>";
}
resultTable +="</td>";
}
resultTable +="</tr>";
}
}
}
}
else{ resultTable="<p>无查询结果</p>";}
document.getElementById("queryResultPanel").innerHTML=resultTable;
}
这个代码供您做个思路的参考不过效果不是特别好,如果您需要比较便利的输出您的数据集内容的话,这里推荐您使用第三方表格空间来实现,这里也给您个链接作为参考:http://www.jb51.net/web/21949.html