 //			}
 		}
 
-		private function handleColumnEntities(event:ResultEvent, token:Object = null):void
+		private function handleColumnEntities(event:ResultEvent, hierarcyNode_entityIds:Array):void
 		{
 			if (objectWasDisposed(this))
 				return;
 
-			var hierarchyNode:XML = token as XML; // the node to add the list of columns to
+			var hierarchyNode:XML = hierarcyNode_entityIds[0] as XML; // the node to add the list of columns to
+			var entityIds:Array = hierarcyNode_entityIds[1] as Array; // ordered list of ids
+
 			try
 			{
-				var entities:Array = event.result as Array
+				var entities:Array = event.result as Array;
+				entities.sort(
+					function(entity1:Object, entity2:Object):int
+					{
+						var i1:int = entityIds.indexOf(entity1.id);
+						var i2:int = entityIds.indexOf(entity2.id);
+						return ObjectUtil.numericCompare(i1, i2);
+					}
+				);
 				
 				// append list of attributes
 				for (var i:int = 0; i < entities.length; i++)
 				{
 					var metadata:Object = entities[i].publicMetadata;
+					metadata['id'] = entities[i].id;
 					var node:XML = <attribute/>;
 					for (var property:String in metadata)
 						if (metadata[property])

	}
}

import weave.api.WeaveAPI;
import weave.data.AttributeColumns.ProxyColumn;

/**

					query = dataService.getEntityIdsByMetadata({"dataTable": dataTableName}, EntityType.COLUMN);
				}
				addAsyncResponder(query, handleColumnIds, handleFault, subtreeNode);
				function handleColumnIds(event:ResultEvent, subtreeNode:XML):void
				{
					var ids:Array = event.result as Array;
					var query:AsyncToken = dataService.getEntitiesById(ids);
					addAsyncResponder(query, handleColumnEntities, handleFault, [subtreeNode, ids]);
				}
			}
		}
