Select to view content in your preferred language

Sort items in Contents Pane

1736
7
03-10-2021 08:43 AM
JoeBorgione
MVP Emeritus

Using ArcGIS Pro 2.7:

Is there a way to sort the items in the contents pane alphabetically? I have a stack of tables I'd like to order that way:

JoeBorgione_0-1615394581005.png

 

That should just about do it....
7 Replies
DuncanHornby
MVP Notable Contributor

I think the short answer is no. If you right click on the map node in the TOC (what I would be calling a data frame in ArcMap) you can reorder layers by name/type, there is no equivalent for standalone tables. I did discover whilst looking into this question you can drag 'n' drop tables into a preferred order, but it would be nice to see a reorder option for tables too.

JoeBorgione
MVP Emeritus

Drag and drop is an option...

 

 

That should just about do it....
0 Kudos
DanPatterson
MVP Esteemed Contributor

four rules to a successful gis career

Pick something you want to do

  • left-click
  • right-click
  • double-click
  • if you don't see what you need you are clicking on the wrong thing or the wrong way.

For example... unorder layers in a table of contents, order them

ordered0.pngordered1.pngordered2.png

might work for other things... or not


... sort of retired...
JoeBorgione
MVP Emeritus

Rats; thought did it, but didn't.  When I right click on Standalone Tables it gives me the choice to reorder layers and that's what it does, but not tables....

JoeBorgione_0-1615405684319.png

 

That should just about do it....
0 Kudos
DanPatterson
MVP Esteemed Contributor

hence the.... 

might work for other things... or not


... sort of retired...
0 Kudos
DuncanHornby
MVP Notable Contributor

You forgot to mention to spin around, touch your toes and shout goooo esri!  ... or not 😀

BrennanSmith1
Regular Contributor

Yes, using arcpy.  See my post here, or the code below.

# get active map in current project
p = arcpy.mp.ArcGISProject("CURRENT")
m = p.activeMap

# sort table names
sortedtables = sorted([t.name for t in m.listTables()])

# create new group
g = m.createGroupLayer("Sorted Tables")

# for each table, add to group and remove the original
for x in sortedtables:
    t = m.listTables(x)[0]
    m.addTableToGroup(g,t)
    m.removeTable(t)
0 Kudos