Select to view content in your preferred language

Filling Datagrid with FeatureSet Values.

2806
20
Jump to solution
02-21-2014 06:02 AM
EvelynHernandez
Frequent Contributor
Hey guys im trapped in this.
I want to fill a datagrid with values obtained from a featureset but i dont know how to get the parameters to put each one in the column that i want. Also the datagrid it is empty !!


Thanks for all the help.


//the Grid.  <mx:DataGrid  id="gridEquipos" x="2" y="5" width="100%" height="100%" visible="true" editable="false" dragEnabled="true" dropEnabled="true" dataProvider="{listaEquipos}" itemClick="gridEquipos_itemClickHandler(event)">                                                <mx:columns>                                                                <mx:DataGridColumn headerText="Código Equipo / Medidor" dataField="id_eq" id="IDEquipo"/>                                                                <mx:DataGridColumn headerText="Cant. Luminarias" dataField="cantLum" id="CantLuminarias"/>                                                                <mx:DataGridColumn headerText="Cant. Tramos" dataField="cantTram" id="CantTramos"/>                                                                <mx:DataGridColumn headerText="Tipo Conexión" dataField="tipoConn" id="TipoConexion"/>                                                                <mx:DataGridColumn headerText="NIS Cliente" dataField="nisClie" id="NisCliente"/>                                                                <mx:DataGridColumn headerText="??lt. Fact." dataField="observ" id="ultimaFacturacion"/>                                                </mx:columns>                                </mx:DataGrid>     //Filling grid function                 protected function gridEquipos_itemClickHandler(event:ListEvent):void                                                {                                                                   gridEquipoxTramo();                                                                var seleccionado:String = new String;                                                                seleccionado = gridEquipos.selectedItem.toString();                                                                acPolyline.removeAll();                                                                var queryTaskEquipoSelected:QueryTask = new QueryTask();                                                                queryTaskEquipoSelected.url = "http://gisred.chilquinta.cl:5555/arcgis/rest/services/AP_Municipal/AP_LA_CRUZ/MapServer/5";                                                                queryTaskEquipoSelected.useAMF = false;                                                                var queryEquipoSelected:Query = new Query();                                                                queryEquipoSelected.outFields = ["*"];                                                                queryEquipoSelected.returnGeometry = true;                                                                                                                                queryEquipoSelected.where = "ARCGIS.DBO.MEDIDORES_AP_006.id_medidor=" + seleccionado;                                                                queryEquipoSelected.spatialRelationship ="esriSpatialRelIntersects";                                                                queryEquipoSelected.outSpatialReference = myMap.spatialReference;                                                                queryTaskEquipoSelected.execute(queryEquipoSelected, new AsyncResponder(onResult, onFault));                                                                listaEquipos.removeAll();                                                                                                                                                                                                                                                function onResult(featureSet:FeatureSet, token:Object = null):void                                                                {                                                                               try{                                                                                               for each (var myGraphic:Graphic in featureSet.features)                                                                                               {                                                                                                                                                                                                                                 myGraphic.symbol=slsFind;                                                                                               //            myGraphic.symbol= infoButton;                                                                                               //            infoB=seleccionado;                                                                                                               graphicsLayer.add(myGraphic);                                                                                                                acPolyline.addItem(graphicsLayer);                                                                                                               myMap.zoomTo(featureSet.features[0].geometry);                                                                                                                                                                  myMap.level = 16;                                                                                               }                                                                                                                                                                              }catch(err:Error){                                                                                               Alert.show("no se pudo cargar el tramo");                                                                               }                                                                                                                                               }                                                                                                                                function onFault(info:Object, token:Object = null):void                                                                {                                                                                  Alert.show("id de equipo no encontrada");                                                                }                                                }
Tags (2)
0 Kudos
20 Replies
EvelynHernandez
Frequent Contributor
Yes i just tried and it doesnt work.
The grid is still in blank....

Also i tried making another grid but it doesnt work either.
Is there a way to know the attribute field's name to see if maybe it is that...
Thanks for ur patience!
0 Kudos
EvelynHernandez
Frequent Contributor
rscheitlin,

Yes i just tried and it doesnt work.
The grid is still in blank....

Is there a way to know the attribute field's name to see if maybe it is that...
Thanks for ur patience!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Evelyn,

   You could trace out the results of featureSet.attributes using
trace(ObjectUtil.toString(featureSet.attributes));
0 Kudos
EvelynHernandez
Frequent Contributor
How can i see the trace results?
Because im using a trial version of FB.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Evelyn,

   Trial version does not matter. When you debug your app using the "little green bug" button to the left of the green play button you will be able to see trace statements in the console window.
0 Kudos
EvelynHernandez
Frequent Contributor
rscheitlin,

It says this

C:\WINDOWS\system32\Macromed\Flash\NPSWF32_12_0_0_70.dll

Flash Builder cannot locate the required debugger version of Adobe Flash Player. You might need to install the debugger version of the Flash Player or reinstall Flash Builder.

Do you want to try to debug with the current version?


And if i run the debugger doesnt show anything.
And i dont know where the console is located.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Evelyn,

  Don't take this the wrong way, but you need to invest some time reading, Googling, and leaning.

https://developers.arcgis.com/flex/guide/debugging-tips.htm

To be able to use the Flash Debugger you have to install the debugger version of Flash Player (look for the download link for your flavor of web browser):

http://www.adobe.com/support/flashplayer/downloads.html

To find the console window: Window menu > show view > console.
0 Kudos
EvelynHernandez
Frequent Contributor
rscheitlin,

I finally did what i wanted to do with this
Attribute table. It is more easy.

https://developers.arcgis.com/flex/sample-code/attributetable.htm



The only problem that i have now is how to get the value of the cell what was clicked on the attribute table. Even if its the first one or second one.
Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Evelyn,

   I think you gave up to soon. Setting up your development environment is going to be very important if you are going to do very much with development in Flex. The trace statement and flash debugger version are great tools for any level of development and spending time getting them ready to use is important.

As far as get a selected cell value from the AttributeTable... I dont work with the Attribute table as it is so much easier for me to setup a spark datagrid. But here is what I think based on the docs:

var at:AttributeTable = new AttributeTable();                 at.dataGrid.selectedItem
0 Kudos
EvelynHernandez
Frequent Contributor
Well i just tried for last time the thing with the datagrid and now it works perfectly.
Really i dont know what happened before, but that makes me to do and learn a lot of new things about alternative ways to face a problem.

I really didnt understand about the trace and debugger and im still learning through googleing.

Thanks for all ur tips (:
0 Kudos