Hi,I'm also having some trouble with implementing grouped layers reordering in my JS app.So far I've succeded in reordering layers inside a group, which is a piece of cake, and is as simple as the example:
/* ------------------------------------------------------------------------------------*/
// Let's assume that we have a dynamic layer with id "dynamicLayerId" on the map
// and the sublayer of "dynamicLayerId" with id 0 is the parent of sublayers with ids 1 and 2
//
// This code will swap sublayers 1 and 2 and display them on the map
/* ------------------------------------------------------------------------------------*/
var layer = map.getLayer("dynamicLayerId");
var dynamicLayerInfos = layer.createDynamicLayerInfosFromLayerInfos();
// changing the order
dynamicLayerInfos[1].id = 2;
dynamicLayerInfos[2].id = 1;
// updating the dynamic infos of the layer
layer.setDynamicLayerInfos(dynamicLayerInfos);
// display the sublayers on the map
layer.setVisibleLayers(["1", "2"]);
What I'm having trouble with is reordering the whole groups. The picture shows what happens inside dynamicLayerInfos when someone tries to reorder the groups in my app:[ATTACH=CONFIG]26695[/ATTACH]After updating the dynamicLayerInfos of the layer, no sublayer is shown on the map (when there are some visibleLayers set). So my question is: Am I doing something wrong here?Also I would really appreciate if someone, who has done it, could share some code ;]PS. It's an old topic, I know, but it'd be bad to leave it without some useful answers;]EDIT: FINALLY!Writing this post and reading it made me realise that I didn't update parentLayerId properties of the group members. I fixed that and the problem is gone - everything works fine :D.