Tuesday, 27 December 2016

Rearranging display order of attribute table fields using QGIS?


Using QGIS 2.10.1, I open an attribute table. How do I rearrange the field display order? For example, a table's default display order (from left to right) is State, County, City. But I would like to see them displayed as City, State, County.


I'm not interested in rearranging the table's internal structure, rather just the table's display.



Answer



You can't, as far as I know, at least in table view. But you can customise forms and use them in the attribute editor to make it easier to view and edit records.


UPDATE as of 2.18 this is possible, see answer from Dan.


Form-based attribute table


There's an alternative form-based view which you might find easier to use (less scrolling than the normal table view).


If you look in the bottom-right corner of the Attribute Table, there's a couple of small icons. Very small icons. Blink and you'll miss them :)



icons to switch between form and table views


Clicking on one of these will show the form-based view, the other the table based view. Here's the standard form view.


attribute table form-based view


Easier to use than your standard 'spreadsheet' view, but still not sorted.


Drag and drop form editor


You can create custom forms for use with attribute editor.


Go into layer properties, "Fields" panel. Change from "Autogenerate" to "Drag and drop designer".


Here, I've used the Natural Earth dataset, which has a lot of columns. You create 'groups' (categories) on the right hand panel using the plus (+) icon. In my case I chose categories 'Population', 'Coding' and 'Names'. You then drag the fields over and drop them on the corresponding category.


using drag-and-drop form editor in qgis


Once the fields are copied over, you can nudge them up and down with the 'up' and 'down' arrow icons. This changes the order.



Now, when you go into attribute editor in 'form' mode, the form editor has one tab per category, and the fields in whichever order you want.


example of custom form in attribute editor


It doesn't affect the default 'table' view, though. Hope that helps!


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...