Marcelo,
The layer parameter you published to AttributeTable must be an instance of `LayerInfo` not a featurelayer.
1、import module ‘jimu/LayerInfos/LayerInfos’ to your module.
2、call getInstance method
LayerInfos.getInstance(map, map.itemInfo).then(layerInfosObj){......}
3、bind the 'layerInfosChanged' event
this.own(layerInfosObj.on(
'layerInfosChanged',
lang.hitch(this, this.onLayerInfosChanged)));
4、get the layerInfo and then publish to AttributeTable
onLayerInfosChanged: function(layerInfo, changeType, layerInfoSelf) {
this.publishData({
target: 'AttributeTable',
layer: layerInfoSelf
});
}
I think the code in "client\stemapp\widgets\LayerList\PopupMenuInfo.js line:260" can help you.
This the code that how does LayerList widget open the AttributeTable.
_onTableItemClick: function(evt) {
// new version, send layerInfo object.
this._layerInfo.getLayerType().then(lang.hitch(this, function(layerType) {
if (this._layerInfo._getLayerTypesOfSupportTable().indexOf(layerType) >= 0) {
evt.layerListWidget.publishData({
'target': 'AttributeTable',
'layer': this._layerInfo
});
}
}));
},