[Cartoweb-users] Show layers in a defined order

Simon ORTET simon.ortet at silogic.fr
Mon Oct 8 04:15:56 EDT 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20071008/16f856fd/attachment.html


More information about the Cartoweb-users mailing list