[Cartoweb-users] Show layers in a defined order

Oliver Christen oliver.christen at camptocamp.com
Tue Oct 9 04:12:04 EDT 2007


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 at lists.maptools.org
  http://lists.maptools.org/mailman/listinfo/cartoweb-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20071009/6b2c9dc6/attachment.html


More information about the Cartoweb-users mailing list