1

I've added

layerControlLayerInfos: { menu: [{ label: 'Query Layer...', iconClass: 'fa fa-search fa-fw', topic: 'queryLayer' }, { label: 'Open Attribute Table', topic: 'openTable', iconClass: 'fa fa-table fa-fw' }] },

What are the additional steps need to launch a attribute table from a sublayer menu?

How do I subscribe other widgets to the topic defined above?

1 Answer 1

1

The attributes table widget doesn't listen for this topic out of the box. It needs an 'invisible' widget to listen for the topic layerControl/openTable which builds its table parameters that will define its fields, and other settings and open the table with attributesContainer/addTable.

widgets: {
    attributesTableMenu: {
        type: 'invisible',
        path: 'dijit/_WidgetBase',
        id: 'attributesTableMenu',
        options: {
            startup: function(){
                topic.subscribe('layerControl/openTable', function(layer){
                    topic.publish('attributesContainer/addTable', {
                        title: layer.subLayer.name,
                        topicID: layer.layer.id + layer.subLayer.id,
                        queryOptions: {
                            queryParameters: {
                                url: layer.layer.url + '/' + layer.subLayer.id,    
                                where: '1=1'
                            }
                    },
                    //other table options 
                    );
                });
            }
        }
    }
}

This is documented at the bottom of the latest CMV docs on this page: http://docs.cmv.io/en/latest/widgets/LayerControl/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.