Instead of storing the editable layers in an associative array (object) in which the keys are the layers ids, we store them in an array. The advantage is that we keep them in the order as in the tree. We can then query the server for features using the visibility order. Thus the features in the response are ordered as well.
I also simplified the way the menu is created. We may have duplicates if layers are available multiple times in the tree, but I don't think it's a big deal.
Instead of storing the editable layers in an associative array (object) in which the keys are the layers ids, we store them in an array. The advantage is that we keep them in the order as in the tree. We can then query the server for features using the visibility order. Thus the features in the response are ordered as well.
I also simplified the way the menu is created. We may have duplicates if layers are available multiple times in the tree, but I don't think it's a big deal.
Please review.