hi,how can we display the query results in attribute table widget,in web appbuilder
Tarun,
You can follow this guide to add a layer to the Attribute table widget:
You will have to create a FeatureLayer from the query results using a Feature collection. See this sample:
in the Widget.js for Query Widget, I made some changes to the _showResultLayerInfo function, and it seems working:
_showResultLayerInfo: function(resultLayerInfo){ this._hideAllSingleQueryResultDijits(); var singleQueryResult = resultLayerInfo.singleQueryResult; var resutlLayer = null; if (singleQueryResult) { html.setStyle(singleQueryResult.domNode, 'display', 'block'); var currentAttrs = singleQueryResult.getCurrentAttrs(); resutlLayer = lang.getObject("query.resultLayer", false, currentAttrs); } if (resutlLayer) { this._activeLayerId = resutlLayer.id; this._hideAllLayers(resutlLayer); resutlLayer.show(); //now show in at widget var layerInfo = this.layerInfosObj.getLayerInfoById(resutlLayer.id); this.publishData({ 'target': 'AttributeTable', 'layer': layerInfo }); }else{ this._activeLayerId = null; this._hideAllLayers(); } },
Hope it helps.