Find Task/DataGrid question

459
2
06-18-2014 04:37 PM
JoshuaPersson
New Contributor III
Hello All-

...I am trying to modify this sample (https://developers.arcgis.com/javascript/jssamples/find_map_datagrid.html) so that the graphic is added to the map when the row in the datagrid is clicked (in the onRowClickHandler function) instead of adding all the graphics for the entire search when the datagrid is populated. Any suggestions would be greatly appreciated!

               Thanks,

                    -Josh
0 Kudos
2 Replies
BenFousek
Occasional Contributor III
Josh,

First, dojox/grid/DataGrid is depreciated. Use dgrid. The esrijs api includes dgrid. Examples of it's use can be found in the esrijs samples.

Use dojo/store/Memory with dgrid. You can add as many pairs to a data item as you want (including your graphic object), not just the attributes for the columns. The row click event will return all the data, and in your case clear the graphics layer and add the graphic from the clicked row to the layer.

Been awhile since I used dojo/data/ItemFileReadStore but I think the above concept could be used with it as well. But do consider switching to dgrid. It's awesome.
0 Kudos
JoshuaPersson
New Contributor III
Josh,

First, dojox/grid/DataGrid is depreciated. Use dgrid. The esrijs api includes dgrid. Examples of it's use can be found in the esrijs samples.

Use dojo/store/Memory with dgrid. You can add as many pairs to a data item as you want (including your graphic object), not just the attributes for the columns. The row click event will return all the data, and in your case clear the graphics layer and add the graphic from the clicked row to the layer.

Been awhile since I used dojo/data/ItemFileReadStore but I think the above concept could be used with it as well. But do consider switching to dgrid. It's awesome.


Thanks Ben- I'll check it out!

-Josh
0 Kudos