Select to view content in your preferred language

how to control number of attribute display fields when using identifyTask

447
1
07-25-2011 03:08 AM
hanwang1
Emerging Contributor
Dear esri flex team

I have a problem on controlling the number of attribute display fields when I use identifytask.Take the live code Identifysample as an example.
function "myResultFunction" as below is the identify result handling function.At the last line
"clickGraphic.attributes = resultGraphic.attributes"
all the attributes of the identify target are restored in resultGraphic.But I don't need all the fields of the attributes,I just need part of them.for example there is a road layer containing 3 fields of attribute,they are 'objectid','shape' and 'length',I don't need 'shape' field,I hope when I do the identify process,the popup window only shows 'objectid' and 'length'. I try to change the code as "clickGraphic.attributes = resultGraphic.attributes["objectid","length"]" but it doesn't work. I am wondering is there anyother way to realize it?

thanks in advance

private function myResultFunction(results:Array, clickGraphic:Graphic = null):void
            {
                if (results && results.length > 0)
                {
                    var result:IdentifyResult = results[0];
                    var resultGraphic:Graphic = result.feature;
                    switch (resultGraphic.geometry.type)
                    {
                        case Geometry.MAPPOINT:
                        {
                            resultGraphic.symbol = smsIdentify;
                            break;
                        }
                        case Geometry.POLYLINE:
                        {
                            resultGraphic.symbol = slsIdentify;
                            break;
                        }
                        case Geometry.POLYGON:
                        {
                            resultGraphic.symbol = sfsIdentify;
                            break;
                        }
                    }
                    lastIdentifyResultGraphic = resultGraphic;

                    // update clickGraphic (from mouse click to returned feature)
                    clickGraphic.symbol = new InfoSymbol(); // use default renderer
                    clickGraphic.attributes = resultGraphic.attributes;
                }
            }
Tags (2)
0 Kudos
1 Reply
DasaPaddock
Esri Regular Contributor
Try:

clickGraphic.attributes = {objectid: resultGraphic.attributes.objectid, length: resultGraphic.attributes. length};
0 Kudos