Select to view content in your preferred language

How to set column widths of datagrid/attribute table with typicalItem or explicitly

3095
4
06-07-2013 12:07 PM
DavidBoiano
Deactivated User
Hello,

I have an application with an attribute table calling a feature service from ArcGIS Server 10.  I also have an Attribute Table skin which has removed the table options button as it was not necessary for our purposes.  The fields in the attribute table are being grabbed using an outFields property as follows:
outFields="[ADDRESS,NEIGHBORHOOD,EST_SPILL_START_DATE,EST_SPILL_END_DATE,EST_SPILL_START_TIME,EST_SPILL_END_TIME,SPILL_VOLUME_GAL,CAUSE,CORRECTIVE_ACTION]


Also, these outFields fields are the actual name, not the alias that displays on my attribute table.  So there are 9 fields that are displayed. The application itself is being embedded into a slightly small 600p x 590pixel window.  Currently, the AttributeTable width is set to 100%. The dataGrid in the skin also has a width of 100%

The most important thing for my application to do is have all the column widths be the appropriate size to fit the largest data item in that field. I understand this is done best practice by using the typicalItem property. However, I have no idea how to get it to work correctly.  If it means ditching the skin, I am okay with that--it is more important to get the column widths so that none of the headers display a "..." ellipse.  I am also ok with setting every column to the same width as long as it's long enough to fit the largest title, I believe that would be "NEIGHBORHOOD"


FYI Below is my code for the attribute table:
  <esri:AttributeTable id="myAttributeTable"
        width="100%" height="100%"
        deleteEnabled="false"
        updateEnabled="false"
        showTitle="false"
        exportLocation="false"
        featureLayer="{myFeatureLayer}"/> 


And this is my code for the dataGrid in my AttributeTableSkin:
   <s:DataGrid id="dataGrid"
      width="100%" height="100%"
      alpha.noFeatures="0.2"
      itemEditor="com.esri.ags.skins.supportClasses.AttributeTableItemEditor"
      itemRenderer="com.esri.ags.skins.supportClasses.AttributeTableItemRenderer"
      selectionMode="multipleRows"/>


To sum:  how do I set the column widths using the typicalItem property? Would it be done on the dataGrid in the skin? Or on the attribute table in my main application?

If the above is too hard/not possible, how can I explicitly set the widths of the columns?

If anyone can answer either of these questions it would be a huge help.  Thank you.

David
Tags (2)
0 Kudos
4 Replies
AnthonyGiles
Honored Contributor
David,

From what I can see this ability is tied up in the sdk, I have submitted a request on GitHub to auto fit the columns but it just seems to get moved to the next milestone and does not get implemented even though Robert has supplied the code on how to do it.

https://github.com/Esri/arcgis-viewer-flex/issues/63

Maybe one of the flex team could advise when this may get implemented

Regards

Anthony
0 Kudos
DavidBoiano
Deactivated User
Hi Anthony,

Thanks for your response. I have been playing around with Robert's code from the eSearch widget, and I have finally gotten rid of all the errors. However, I still haven't gotten it to run correctly so that any of the column widths in my attribute table are fitted to the content.  Perhaps I am taking the wrong approach? Should this code be inserted into the Script tag in my AttributeTableSkin.mxml or directly into my web application?  I have tried putting it into the skin.

Specifically, I am not sure how to parse in my data from my featureLayer being called in my web application into the code that is currently sitting in my attribute table skin. I have tried to define "resultsGrid" as a DataGrid type but I am not sure how to connect the code that calls on the dataprovider from the eSearch widget code to my data which is being provided by a feature service.

Any ideas?

Thanks!

David
0 Kudos
AnthonyGiles
Honored Contributor
David,

The grid used in the attribute table is as far as I know tied up in the sdk, you will not be able to change the widths that's why I have put the enhancement request to the flex team.

Regards

Anthony
0 Kudos
DavidBoiano
Deactivated User
Anthony,

Thanks, I guess I didn't fully understand. I thought I could possibly use the eSearch code to make it happen.

I agree, I hope this enhancement comes out in the next release.


David
0 Kudos