mmm, maybe you can trigger the layer selection by using the filter layer_select=layer_to_select_1,layer_to_select_2,... at the same time you do the layer reorder call. if im not wrong, the filter will trigger the layer selection before layerReorder is called, meaning the layers *should* be in selectedMsLayerIds
regards Oliver ----- Original Message ----- From: Simon ORTET To: Oliver Christen Cc: cartoweb Sent: Tuesday, October 09, 2007 10:25 AM Subject: Re: [Cartoweb-users] Show layers in a defined order Hi Oliver On line 478 I have : $this->orderedMsLayerIds[] = $this->selectedMsLayerIds[$id]; Cartoweb can't find the $id index in the selectedMsLayerIds collection. I made a print_r of the selectedMsLayerIds collection and i miss a layer that i checked by javascript chargeVue() function. So i assumed that Cartoweb needs first a CartoWeb.trigger('Layers.LayerShowHide'); call to gather the layers checked in the tree and update its collection. And only then, i can make the CartoWeb.trigger('LayerReorder.Apply'); to reorder these layers. The problem is that i want to do that in only 1 ajax call. I'd like to avoid writing a new plugin. What could you advise me? Thanks for your help. Simon Ortet Silogic Oliver Christen a écrit : what do you have at line 478 of your ClientLayerReorder.php file? I only see a comment at that line regards Oliver ----- Original Message ----- From: Simon ORTET To: cartoweb Sent: Monday, October 08, 2007 10:15 AM Subject: [Cartoweb-users] Show layers in a defined order Hi everyone. I'm trying to do a 2 in 1 action with Cartoweb: Show some layers in a special order. So it means i have to check some layers in the layers tree and reorder them. Finally i make the ajax call to make Cartoweb apply the changes. The problem is Cartoweb seems not to know the layers i just checked. Here's the error message. version: 3.3.0 [$Revision: 1.2 $] class: CartocommonException message: Error [8, Undefined index: 1, /opt/cartoweb/cartoweb3/projects/aeag/plugins/layerReorder/client/ClientLayerReorder.php, 478] So here's the function i made to do this. function chargeVue() { // Here i get the layers i need to show in a field of my form for (var i=0; i<$('selectVue').options.length; i++) { if ($('selectVue').options[i].selected ) { selectione = $('selectVue').options[i].value; } } // Here i check the layers i got in the layer tree var tabSel = $('vue_'+selectione).value.split(";"); var tabOrdre = new Array(); var celts = $('layersroot').getElementsByTagName('input'); for (var j = 0; j < celts.length; j++) { if (!celts[j].checked && inArray(tabSel,celts[j].value)) { celts[j].checked = true; // Here i store the order of the layers in the layers tree tabOrdre.push(celts[j].value); }else celts[j].checked = false; } // Here i fill an array with the new layers order var tabNewOrdre = new Array(); for (j = 0; j < tabSel.length; j++) { // Ajoute l'indice de la couche dans tabOrdre tabNewOrdre.push(indexInArray(tabOrdre,tabSel[j])); } $('layersReorder').value = tabNewOrdre.join(","); // Here i update the map CartoWeb.trigger('Layers.LayerShowHide'); } Is there a way to achieve this without making 2 ajax calls (one to check the layers, the other to order them)? Thanks for your help Simon Ortet Silogic -------------------------------------------------------------------------- _______________________________________________ Cartoweb-users mailing list Cartoweb-users@lists.maptools.org http://lists.maptools.org/mailman/listinfo/cartoweb-users
_______________________________________________ Cartoweb-users mailing list Cartoweb-users@lists.maptools.org http://lists.maptools.org/mailman/listinfo/cartoweb-users