1

I am attempting to manipulate a custom widget (Table) I built. I first initialize the widget in the viewer.js class and attach it to the 'sidebarBottom' pane in the viewer. Since the 'Find' widget is a titlePane and attached to the sidebar, I need a way to pass attributes in between each widget.

if I initialize the custom widget in the viewer.js class I can successfully attach it to the bottom pane, but I do not know how to pass dojo/dijit arguments to it via the Find widget. I have attempted to use dojo.byId() with no success.

If I initialize my custom widget from inside of the Find widget using the second block of code, I can successfully set() and get() attributes. However, I am unable to attach the widget to the "sidebarBottom" pane defined in the viewer.js declaration.

Table Widget Section in Viewer.js:

  table: {
            include: true,
            id: 'table',
            type: 'contentPane',
            path: 'gis/dijit/Table',
            placeAt: 'bottom',
            options: { 
                map: true,
            }
        },   

Table Widget Init in 'Find' Widget Class

        var fOut = query.url + "/" + query.layerIds;
        var table;
            table = new Table({
                include: true,
                open: true,
                FeatureInput: fOut,
                map: this.map,
                //placeAt: this.bottom,
            });
           alert(table.get('FeatureInput'));
           alert(table.get('open'));

1 Answer 1

0

This is the same answer I provided in the cmv gitter chat.

Probably the simplest is to use dojo's topic.publish and topic.subscribe. That's how a number of the core cmv widgets communicate with each other. The simplest case you will probably find is when another widget (like the locator) sends info to the Growler widget. To get the concept of how topics work, read the dojo docs and examine how those two widgets communicate.

In addition, I have a search widget (sort of like find but different) that communicates with an attributes table widget in much the same way you describe. You can find them in my repo here: https://github.com/tmcgee/cmv-widgets. The communication between those widget is bit complex but also relies on topic publish/subscribe.

1
  • Thank you! This is the perfect amount of info, especially referencing the Growler code. I haven't coded yet, but after reading the documentation I more confident about it.
    – Andrew T
    Mar 8, 2015 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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