Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have two ways to display an InfoWindow with the attributes of a graphic. The first is using a IdentifyTask to return the graphic and the other gets the selectedItem of a Datagrid (rovGrid) and using the findGraphicByAttribute code to return the graphic.

However, the format of the Date field is different in the returned graphic. The IdentifyTask graphic attribute shows "2/10/2005" and the Datagrid graphic attribute shows "1107993600000". Why are the two methods showing different date formats for the same feature?

Here's the partial code for each method

//IdentifyTask

identifyTask.execute(identifyParams, new AsyncResponder(onResult, onFault, clickGraphic));

function onResult(results:Array, clickGraphic:Graphic = null):void
{
    if (results && results.length > 0)
    {
        var result:IdentifyResult = results[0];
        var resultGraphic:Graphic = result.feature;

//Datagrid click

private function rovGrid_Click():void { var obj:Object = rovGrid.selectedItem;

if (obj != null)
{
    MainMap.infoWindow.hide();

    var graphic:Graphic = findGraphicByAttribute(obj, layerROVGraphics);

attributes for each return

share|improve this question
    
Can you reduce this to a REST API issue? In other words, is the date value returned by the server for an Identify request different from that returned by a Query? Use Fiddler to see what the urls are, then change the json to pjson in the request to see what the response is. –  Kirk Kuykendall Jun 24 '11 at 21:38

1 Answer 1

up vote 1 down vote accepted

I think Kirk nailed it. The DataGrid turns the values into an ArrayCollection as the DataGrid.dataProvider. When it does this, Flex does some internal stuff to bind these values to the DataGrid (notice the mx_internal_uid property). It looks like when it does this, it no longer knows the value shown should represent a date, it leaves this format responsibility up to the developer.

share|improve this answer
    
I put in some additional code to convert the string to a Date, then ran that through the DateFormatter. I also had to put some additional code in to catch nulls, since I would get back either "Null" or "null" when clicking on a point with no value in the date field. The DateFormatter will take "Null" but not "null". –  kenbuja Jun 28 '11 at 19:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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