In general terms, a key set in a Java Map is unordered. You could impose an ordering on a set by copying its contents to a SortedSet such as TreeSet, or in case of a Map use a TreeMap. Pass it a Comparator<imendixobjectmember> in the constructor that compares two members and returns a negative, 0, or positive value accordingly.
Something like this:
Comparator comp = new Comparator<String>() {
public int compare(String s1, String s2) {
return s1.compareTo(s2); // lexicographic order
}
}
SortedMap<String,? extends IMendixObjectMember> mxObj = new TreeMap<String,? extends IMendixObjectMember>(comp);
mxObj.putAll(obj.getMembers(this.context));
for(String key : mxObj.keySet()) {
IMendixObjectMember mxObjMember = mxObj.get(key);
// fill cell contents
}
I doubt there is a way of reconstructing the order from the entity model.