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:
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.
Drag and drop is an option...
four rules to a successful gis career
Pick something you want to do
For example... unorder layers in a table of contents, order them
might work for other things... or not
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....
hence the....
might work for other things... or not
You forgot to mention to spin around, touch your toes and shout goooo esri! ... or not 😀
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)