Select to view content in your preferred language

New Attribute Table Widget

6275
20
12-18-2012 06:29 PM
ShaunWeston
Frequent Contributor
Stuggling to get this new widget to work. I'm finding if I specify in the config something like this:

<layer label="Boundaries" url="http://testserver/arcgis/rest/services/Boundaries/Boundaries/MapServer/0"></layer> <!-- non-mapped layer(s), added for just this widget -->

It works and show all features, but doesn't update when you pan to a new extent and if I set the config like this:

  <layersettings>
     <layer name="Boundaries"> <!-- Overwriting layer settings for a map service layer -->
         <sublayer id="0" iseditable="false"> <!-- is editable only supported for a sub layer within a map service layer -->
             <fields>
                 <field name="objectid" alias="ObjectID"/>                  
             </fields>
             <showobjectid>false</showobjectid>
             <showglobalid>false</showglobalid>
             <exportlocation>true</exportlocation>         
             <showattachments>false</showattachments>
             <showrelatedrecords>false</showrelatedrecords>
             <columnsorder>alphabetical</columnsorder>    
         </sublayer>
     </layer>    
  </layersettings>

The above references a map service like this in my main config file:

             <layer label="Boundaries" type="dynamic" visible="false" alpha="1.0"
             url="http://testserver/arcgis/rest/services/Boundaries/Boundaries/MapServer"/>

It doesn't work at all. What am I doing wrong and how can I set this attribute table to work with map services I have defined in the main config file?
Tags (2)
0 Kudos
20 Replies
HeatherGonzago
Esri Contributor
Stuggling to get this new widget to work. I'm finding if I specify in the config something like this:

<layer label="Boundaries" url="http://testserver/arcgis/rest/services/Boundaries/Boundaries/MapServer/0"></layer> <!-- non-mapped layer(s), added for just this widget -->

It works and show all features, but doesn't update when you pan to a new extent and if I set the config like this:

  <layersettings>
     <layer name="Boundaries"> <!-- Overwriting layer settings for a map service layer -->
         <sublayer id="0" iseditable="false"> <!-- is editable only supported for a sub layer within a map service layer -->
             <fields>
                 <field name="objectid" alias="ObjectID"/>                  
             </fields>
             <showobjectid>false</showobjectid>
             <showglobalid>false</showglobalid>
             <exportlocation>true</exportlocation>         
             <showattachments>false</showattachments>
             <showrelatedrecords>false</showrelatedrecords>
             <columnsorder>alphabetical</columnsorder>    
         </sublayer>
     </layer>    
  </layersettings>

The above references a map service like this in my main config file:

             <layer label="Boundaries" type="dynamic" visible="false" alpha="1.0"
             url="http://testserver/arcgis/rest/services/Boundaries/Boundaries/MapServer"/>

It doesn't work at all. What am I doing wrong and how can I set this attribute table to work with map services I have defined in the main config file?



Are you adding the boundaries to the map or no? You mention that the "above references a map service" and points to the boundaries map server but then in the config file at the top you have a layer in it which you are adding that is NOT added to the map.
0 Kudos
SarthakDatt
Frequent Contributor
Hey Shaun,

Just to clarify a bit more, the AttributeTable widget allows you to:
a) work with layers added to the map (for feature layers, it directly adds them, for a map service it goes in an find the corresponding featurelayers and adds them)

e.g:

     <operationallayers>
            <layer label="311" type="feature" visible="false" alpha="1.0"                   
                   url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"/>
            <layer label="PoolPermits" type="dynamic" visible="false" alpha="1.0"                   
                   url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer"/>
      </operationallayers>


Would add 311 layer and corresponding feature layers(2) from PoolPermits map service. You dont have to do anything in the widget's config for this.

b) work with layers that are not added to the map, for this you have to specify the <layer> in the widget's config:

<layer label="Military_Units" url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/2">


It works and show all features, but doesn't update when you pan to a new extent

As this layer is not added to the map, the Attribute Table will on be updated on extent change.

c) allows you to update/over write layer settings using the <layersettings> tag: http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Attribute_Table_widget_tags/01m...
0 Kudos
RhettZufelt
MVP Notable Contributor
Hey Shaun,

Just to clarify a bit more, the AttributeTable widget allows you to:
a) work with layers added to the map (for feature layers, it directly adds them, for a map service it goes in an find the corresponding featurelayers and adds them)

e.g:

     <operationallayers>
            <layer label="311" type="feature" visible="false" alpha="1.0"                   
                   url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"/>
            <layer label="PoolPermits" type="dynamic" visible="false" alpha="1.0"                   
                   url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer"/>
      </operationallayers>


Would add 311 layer and corresponding feature layers(2) from PoolPermits map service. You dont have to do anything in the widget's config for this.


Is this really true?  I can see the attributes from any service loaded as type="feature", but I see no attribute information at all with any of the type="dynamic" mapservices using the default attributetablewidget.xml.
The only example in the documentaion is for AppBuilder and it has a screenshot allowing you to select which layers to show in the attribute table.  Is this actually modifying the xml to show sublayers, or is the AttributeWidget actually supposed to show them all by default like it does with type="feature"?

Thanks,

R_
0 Kudos
SarthakDatt
Frequent Contributor
Is this really true?  I can see the attributes from any service loaded as type="feature", but I see no attribute information at all with any of the type="dynamic" mapservices using the default attributetablewidget.xml.
The only example in the documentaion is for AppBuilder and it has a screenshot allowing you to select which layers to show in the attribute table.  Is this actually modifying the xml to show sublayers, or is the AttributeWidget actually supposed to show them all by default like it does with type="feature"?

Thanks,

R_


Yes, make sure the dynamic map service has visible=true. The AT widget will only add tabs for visible layers(applies for feature layers as well) In the sample config I posted you can change visible=true on PoolPermits to see AT widget including the feature layers.

The way configuring AT widget in AppBuilder works is that by default it shows you all the possible layers the widget would add, by unchecking the checkboxes it would actually write out <excludelayer> tag to the widget config. At 3.1 we added a way where you can exclude layers within mapservice as well: <excludelayer>mapservicename/sublayerid<excludelayer>
0 Kudos
RhettZufelt
MVP Notable Contributor
So, is there something special about the ESRI service(s) you listed below, as both of them will show up in the attribute table.  Of course, the way you coded it visible="false", one has to actually click the checkbox to turn it on.
The first time I turn on the dynamic layer I get this error (twice):

TypeError: Error #1009: Cannot access a property or method of a null object reference.
 at com.esri.ags.components::AttributeTable/updateGraphicCollection()
 at com.esri.ags.components::AttributeTable/checkForVisibilityAndScale()
 at com.esri.ags.components::AttributeTable/refresh()
 at widgets.AttributeTable::AttributeTableWidget/featureLayer_hideShowHandler()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.core::UIComponent/dispatchEvent()
 at mx.core::UIComponent/setVisible()
 at mx.core::UIComponent/set visible()
 at com.esri.ags.layers::Layer/set visible()
 at widgets.AttributeTable::AttributeTableWidget/updateFeatureLayersVisibility()
 at widgets.AttributeTable::AttributeTableWidget/layer_hideShowHandler()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.core::UIComponent/dispatchEvent()
 at mx.core::UIComponent/setVisible()
 at mx.core::UIComponent/set visible()
 at com.esri.ags.layers::Layer/set visible()
 at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem/refreshLayer()
 at com.esri.viewer.components.toc.tocClasses::TocItem/setVisible()
 at com.esri.viewer.components.toc.tocClasses::TocItem/set visible()
 at com.esri.viewer.components.toc.tocClasses::TocItemRenderer/onCheckBoxClick()


after dismissing/continuing past the error, it seems to load/unload the attributes as you check/un-check the checkbox (as expected) so it appears to actually honor the visible="" from the checkbox.  If I uncheck a layer, it's tab is removed from the attribute table.  If I load as visible="true", then I never get the error, no matter how many times I check/uncheck the box.  With the type="feature" layer, I never get the error, no matter if visible on load or not.

However, no matter how I load my services, I only see the attributes if I load them as type="feature", and will NOT show any attributes from a dynamic service.

     <operationallayers>
            <layer label="311" type="feature" visible="false" alpha="1.0"                   
                   url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"/>
            <layer label="PoolPermits" type="dynamic" visible="true" alpha="1.0"                   
                   url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer"/>

 <layer label="WasteSites" type="dynamic" visible="true" alpha="1"
  url="http://gis01.wch-rcc.com/ArcGIS/rest/services/Base/All_Waste_Sites2/MapServer"/> 
 <layer label="MRTest" type="feature" visible="true" alpha="0.5"
  url="http://gis01.wch-rcc.com/ArcGIS/rest/services/rkz/mrtest/MapServer/0"/>    
      </operationallayers>


In this example the MRTest attributes populate the grid, WasteSites just seems to be ignored (no tab, no data, nothing).  Same thing if I load the MRTest as dynamic.
Unfortunatly, my service is not public, but here is how I have it loaded.  Do you see anything I am missing?  This is a AGS 10.05 service, and have also tried with 10.11 service, but no joy.

Any ideas?

R_
0 Kudos
HeatherGonzago
Esri Contributor
Is this really true?  I can see the attributes from any service loaded as type="feature", but I see no attribute information at all with any of the type="dynamic" mapservices using the default attributetablewidget.xml.
The only example in the documentaion is for AppBuilder and it has a screenshot allowing you to select which layers to show in the attribute table.  Is this actually modifying the xml to show sublayers, or is the AttributeWidget actually supposed to show them all by default like it does with type="feature"?

Thanks,

R_


Actually there is an example and screenshot showing it from the source/config tags as well.

http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Attribute_Table_widget_tags/01m...

After the tag description, there is a code snippet with the resulting screenshot.
0 Kudos
SarthakDatt
Frequent Contributor
So, is there something special about the ESRI service(s) you listed below, as both of them will show up in the attribute table. Of course, the way you coded it visible="false", one has to actually click the checkbox to turn it on. 
The first time I turn on the dynamic layer I get this error (twice): 

TypeError: Error #1009: Cannot access a property or method of a null object reference.
 at com.esri.ags.components::AttributeTable/updateGraphicCollection()
 at com.esri.ags.components::AttributeTable/checkForVisibilityAndScale()
 at com.esri.ags.components::AttributeTable/refresh()
 at widgets.AttributeTable::AttributeTableWidget/featureLayer_hideShowHandler()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.core::UIComponent/dispatchEvent()
 at mx.core::UIComponent/setVisible()
 at mx.core::UIComponent/set visible()
 at com.esri.ags.layers::Layer/set visible()
 at widgets.AttributeTable::AttributeTableWidget/updateFeatureLayersVisibility()
 at widgets.AttributeTable::AttributeTableWidget/layer_hideShowHandler()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.core::UIComponent/dispatchEvent()
 at mx.core::UIComponent/setVisible()
 at mx.core::UIComponent/set visible()
 at com.esri.ags.layers::Layer/set visible()
 at com.esri.viewer.components.toc.tocClasses::TocMapLayerItem/refreshLayer()
 at com.esri.viewer.components.toc.tocClasses::TocItem/setVisible()
 at com.esri.viewer.components.toc.tocClasses::TocItem/set visible()
 at com.esri.viewer.components.toc.tocClasses::TocItemRenderer/onCheckBoxClick()


after dismissing/continuing past the error, it seems to load/unload the attributes as you check/un-check the checkbox (as expected) so it appears to actually honor the visible="" from the checkbox. If I uncheck a layer, it's tab is removed from the attribute table. If I load as visible="true", then I never get the error, no matter how many times I check/uncheck the box. With the type="feature" layer, I never get the error, no matter if visible on load or not. 



I noticed that the error happens with the ESRI services as well for dynamic map service. The workaround is to open the AT widget after turning on the dynamic map service(if used as a regular widget) or to have them visible to start with(if using it as docked).

You can fix it in the widget code by commenting out line 930 in AttributeTableWidget.mxml:

//                    AttributeTable(featureLayerToAttributeTable[featureLayer]).refresh();



However, no matter how I load my services, I only see the attributes if I load them as type="feature", and will NOT show any attributes from a dynamic service. 

     <operationallayers>
            <layer label="311" type="feature" visible="false" alpha="1.0"                   
                   url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"/>
            <layer label="PoolPermits" type="dynamic" visible="true" alpha="1.0"                   
                   url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer"/>

 <layer label="WasteSites" type="dynamic" visible="true" alpha="1"
  url="http://gis01.wch-rcc.com/ArcGIS/rest/services/Base/All_Waste_Sites2/MapServer"/> 
 <layer label="MRTest" type="feature" visible="true" alpha="0.5"
  url="http://gis01.wch-rcc.com/ArcGIS/rest/services/rkz/mrtest/MapServer/0"/>    
      </operationallayers>


In this example the MRTest attributes populate the grid, WasteSites just seems to be ignored (no tab, no data, nothing). Same thing if I load the MRTest as dynamic. 
Unfortunatly, my service is not public, but here is how I have it loaded. Do you see anything I am missing? This is a AGS 10.05 service, and have also tried with 10.11 service, but no joy. 

Any ideas? 

R_


Your configuration seems fine. Does "http://gis01.wch-rcc.com/ArcGIS/rest/services/Base/All_Waste_Sites2/MapServer" have a corresponding Feature service? The widget would try to look at "http://gis01.wch-rcc.com/ArcGIS/rest/services/Base/All_Waste_Sites2/FeatureServer" and check if it exists and has feature layers, then would add them
0 Kudos
RhettZufelt
MVP Notable Contributor
After more testing, it appears as if using dynamic layers in the attribute table is only available for those users running SDE.

Or at least, the only way I can get a "dynamic" layer to add it's attribute information to the attribute table is if there is also a matching FeatureServer to go along with the MapServer (even though I only load from MapServer).

At least it appears that way.  the only difference I could see in my services that don't work, and the ESRI services that do is the matching FeatureServer for the mapservice.  Once I add a FeatureServer, but still load only the MapServer/ dynamic service, THEN I will get the attribute information in the table.

Of course, we avoid SDE like the plague, so I only have it set up for "testing", and my testing says it is required to utilize the attributewidget with dynamic layers (at least with default config, have not tried altering the xml to override this yet).

R_
0 Kudos
RhettZufelt
MVP Notable Contributor
Thanks Sarthak,

That is what I found by testing and looking at the differences as well.  Is there a workaround for non SDE users?  Like I said, have not tried to override in the xml yet, but wouldn't really get me what I want anyway.
I want to have the tabs appear/dissapear as the layers on toggled on/off (like it currently works with SDE), but with non SDE data.

Thanks again,

R_
0 Kudos