Hi all,
I was wondering if there is a way to keep ObjectID from displaying when users view the query results in the attribute table.
Any pointers will be greatly appreciated!
Lesi
Solved! Go to Solution.
Lesi,
In the Query Widget Widget.js make this change to the _showResultLayerInfo (line 17 - 21):
_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);
array.map(layerInfo.layerObject.fields, function(fld){
if(fld.name === layerInfo.layerObject.objectIdField){
fld.show = false;
}
});
this.publishData({
'target': 'AttributeTable',
'layer': layerInfo
});
}else{
this._activeLayerId = null;
this._hideAllLayers();
}
},
Lesi,
In the Query Widget Widget.js make this change to the _showResultLayerInfo (line 17 - 21):
_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);
array.map(layerInfo.layerObject.fields, function(fld){
if(fld.name === layerInfo.layerObject.objectIdField){
fld.show = false;
}
});
this.publishData({
'target': 'AttributeTable',
'layer': layerInfo
});
}else{
this._activeLayerId = null;
this._hideAllLayers();
}
},
Thank you, Robert!
Hello @RobertScheitlin__GISP ! How are you?
I have an application that was developed with web appbuilder 2.2, and I need the objectid fields not to appear in the layer tabs inside the attribute table widget. I checked your code given as a solution, however in the application I need to work on, the "Query" widget does not exist in the list of widgets used in the application. I've tried to debug and change the code inside the attribute table widget.js, but unfortunately I was not successful. Do you have any other suggestions for me?
Thanks in advance for your help.
Gilberto.