format datagrid question

2001
14
Jump to solution
06-29-2012 06:47 AM
TracySchloss
Honored Contributor
I would like to be able to take the attributes from a featureSet and display them more like an mailing address in a pane along side my map.

Facility Name
Address
City, State

I see that I can easily put this information in a grid, but then the data is presented as columns and I really want a much smaller footprint on the screen.

I know how to do this in Flex using a datagrid renderer, but I don't see that there is such a thing in JavaScript.
0 Kudos
14 Replies
TracySchloss
Honored Contributor
I was trying to put it within the constructor, so I was close. 

I see a lot of potential for dGrid vs DataGrid.  I wish there were a few more examples.  Mostly I've been looking at http://www.sitepen.com/blog/2011/10/26/introducing-the-next-grid-dgrid/   If you know of other good places to check, please let me know.   I'd like to also have this tied to a mouse over event.  I need to be able to highlight a feature on the list and have it highlight on the map and vice versa.  I have an existing FLEX application and I'm trying to get all the functionality moved into JS.  It's not easy! 

In an example from the 2009 DS, I see someone used dojo.connect (grid, "onRowMouseOver", function () { } but dGrid seems to be different enough that I'm not going to be able to do this.  Instead it looks like the grid can be extended to be a SelectionGrid?  

I think I need to do some more reading.   I'm a Flex developer and using all that terminology !
0 Kudos
KellyHutchins
Esri Notable Contributor
Here's a link to a sample that should help. This sample highlights features when users click the id field of the grid.

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_dgrid.html

If you wanted to select features when the users click anywhere on the row you could modify it to something like this:

     grid.on('.dgrid-row:click',function(event){
                  var row = grid.row(event);
                  //select the feature that matches the row click here 
                  
                });


0 Kudos
TracySchloss
Honored Contributor
My code was working well and suddenly the sort doesn't work anymore.  I don't see any errors and I've not changed the functions that deal with it.  Very frustrating.
0 Kudos
TracySchloss
Honored Contributor
Found it - I had my sort before my grid.renderArray.  Doesn't work that way!
0 Kudos
LetaRogers
Occasional Contributor
You can do this using a Dojo dgrid. We have a sample in the help that specifies a custom renderer for a dgrid.

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/portal_getgroup.html

<snip>



Sample now at:

http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/portal_getgroup.html

and here it is updated to use Asynchronous Module Definition (AMD):

http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/portal_getgroupamd.html
0 Kudos