diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/TapSchemaEditingBean.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/TapSchemaEditingBean.java
index bedb38c1a299bc708ac1b1390df456aecaead3b4..82f4940ec819557bb243e7fec346d8a205033e05 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/TapSchemaEditingBean.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/TapSchemaEditingBean.java
@@ -39,6 +39,8 @@ import it.inaf.ia2.tsm.UpdateOperations;
 import java.io.Serializable;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Objects;
 import javax.faces.context.FacesContext;
@@ -517,4 +519,45 @@ public class TapSchemaEditingBean implements Serializable {
             }
         }).getString();
     }
+
+    /**
+     * Returns the columns list sorting them using {@code column_index} if
+     * available.
+     */
+    public List<Column> getColumns() {
+        Table table = getSelectedTable();
+        if (table == null) {
+            return null;
+        }
+
+        List<Column> columns = new ArrayList<>(table.getAddedOrRemovedChildren());
+
+        if (hasColumnsSorter) {
+            Collections.sort(columns, new Comparator<Column>() {
+                @Override
+                public int compare(Column column1, Column column2) {
+                    Integer columnIndex1 = column1.getValue(Column.COLUMN_INDEX, Integer.class);
+                    Integer columnIndex2 = column2.getValue(Column.COLUMN_INDEX, Integer.class);
+
+                    if (columnIndex1 == null && columnIndex2 == null) {
+                        // When column index is not specified use the column name for sorting
+                        return column1.getName().compareToIgnoreCase(column2.getName());
+                    }
+
+                    // Columns with the column index must be shown before the ones which don't have it.
+                    if (columnIndex1 != null && columnIndex2 == null) {
+                        return -1;
+                    }
+                    if (columnIndex1 == null && columnIndex2 != null) {
+                        return 1;
+                    }
+
+                    // Compare the column indexes if they are not null.
+                    return columnIndex1.compareTo(columnIndex2);
+                }
+            });
+        }
+
+        return columns;
+    }
 }
diff --git a/TASMAN-webapp/src/main/webapp/resources/js/columns-sorter.js b/TASMAN-webapp/src/main/webapp/resources/js/columns-sorter.js
index 96b4b0b84f7ae22e9ca153259c8d3496572d2b4e..80d7dff483527ec9ac8048e76cdaefc69d6f7367 100644
--- a/TASMAN-webapp/src/main/webapp/resources/js/columns-sorter.js
+++ b/TASMAN-webapp/src/main/webapp/resources/js/columns-sorter.js
@@ -96,7 +96,7 @@
                 jsf.ajax.request('main', null, {
                     'javax.faces.behavior.event': 'action',
                     execute: '@none',
-                    render: 'main:column_wrapper',
+                    render: 'main:tables_wrapper',
                     onevent: function (event) {
                         if (event.status === 'success') {
                             $('#columns-sorter').modal('hide');
diff --git a/TASMAN-webapp/src/main/webapp/tapSchemaEditing.xhtml b/TASMAN-webapp/src/main/webapp/tapSchemaEditing.xhtml
index e2518753d926460bf6b41d44b949ddf56448b8f3..b47cb52f0ff634ce8cab8f9cf8334b6a540c2ba6 100644
--- a/TASMAN-webapp/src/main/webapp/tapSchemaEditing.xhtml
+++ b/TASMAN-webapp/src/main/webapp/tapSchemaEditing.xhtml
@@ -243,7 +243,7 @@
                                         <div class="columns-wrapper">
                                             <div class="columns-selector">
                                                 <ul class="nav nav-pills">
-                                                    <ui:repeat value="#{tapSchemaEditing.selectedTable.addedOrRemovedChildren}" var="column" id="columns-list">
+                                                    <ui:repeat value="#{tapSchemaEditing.columns}" var="column" id="columns-list">
                                                         <li role="presentation" class="#{tapSchemaEditing.selectedColumn.name eq column.name ? 'active': ''}">
                                                             <h:commandLink role="tab" action="#{tapSchemaEditing.setSelectedColumn(column)}" id="column-selector">
                                                                 <h:commandButton class="btn btn-link remove-btn" disabled="#{!tapSchemaEditing.isColumnRemovable(column)}" value="&#215;" onclick="TSM.stopPropagation(event)" id="column-remover">