1

I am trying to add multiple tables using tabs to one of my viewers but can't get it to work. Below is the code that I have added to my viewer.js widget option (it adds a table for 'Site 2' but not 'Site 1').

attributesTable: {
            include: true,
            id: 'attributesContainer',
            type: 'domNode',
            srcNodeRef: 'attributesContainer',
            path: 'gis/dijit/AttributesTable',
            options: {
                map: true,
                mapClickMode: true,

                // use a tab container for multiple tables or
                // show only a single table
                useTabs: true,

                // used to open the sidebar after a query has completed
                sidebarID: 'sidebarBottom',

                // optional tables to load when the widget is first instantiated
                tables: [
                    {
                        title: 'Site 1',
                        topicID: 'site1Query',
                        queryOptions: {
                            queryParameters: {
                                url: 'https://your.rest.url.com/gis/rest/services/XXXX/YourMapService/MapServer/9',
                                maxAllowableOffset: 100
                                },
                            idProperty: 'OBJECTID'


                        },


                        title: 'Site 2',
                        topicID: 'site2Query',
                        queryOptions: {
                            queryParameters: {
                                url: 'https://your.rest.url.com/gis/rest/services/XXXX/YourMapService/MapServer/10',
                                maxAllowableOffset: 100
                               },
                            idProperty: 'OBJECTID'


                        }
                    }
                ]
            }
        },

1 Answer 1

3

You only have one table in the configuration with two of each property (title, queryOptions, etc). The effective result is that only the second property with the same name is evaluated and used.

To fix this, you need to add a closing curly brace } to end the configuration object for the first table followed by a comma. Then an opening curly brace { is needed to begin the configuration object for the second table. This is your tables array from your config with these changes:

tables: [
   {
       title: 'Site 1',
       topicID: 'site1Query',
       queryOptions: {
           queryParameters: {
               url: 'https://your.rest.url.com/gis/rest/services/XXXX/YourMapService/MapServer/9',
               maxAllowableOffset: 100
           },
           idProperty: 'OBJECTID'
       },
   },
   {
       title: 'Site 2',
       topicID: 'site2Query',
       queryOptions: {
           queryParameters: {
               url: 'https://your.rest.url.com/gis/rest/services/XXXX/YourMapService/MapServer/10',
               maxAllowableOffset: 100
           },
           idProperty: 'OBJECTID'
       }
   }
]

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.