[Chameleon] Layer order change WITHOUT reloading the page for JSAPI

Julien-Samuel Lacroix jlacroix at mapgears.com
Tue Jun 20 10:41:27 EDT 2006


Hi,
Cool! That seems really great! Do you think you will be able to 
contribute it back? For the page reloading, you ca check the file 
chameleon/htdocs/widgets/NavTool.php

In the NavSetActiveTool JS function, you will have some code that trig 
the map refresh. It looks like:
	
     {$this->mszHTMLForm}.NAV_CMD.value = "LEGENDTEMPLATE_LAYERS";
     {$this->mszHTMLForm}.NAV_ALLOW_RECTANGLE.value=false;
     {$this->mszHTMLForm}.NAV_SUBMIT.value=false;
     goCWCJSAPI.UpdateNavTools();


Then you will have to add a LEGENDTEMPLATE_LAYERS event in the 
chameleon/htdocs/UpdateMap.php

Hope that helps

Julien


Carlo Tronnberg wrote:
> Dear List!
>  
> I have made a sortable Legend management based on the LegendTemplate 
> widget but using drag and drop to move the layers. It works very well 
> but since I do not need to refresh the layer list anymore (reload the 
> page). Is it possible to tell mapserver about the new order WITHOUT 
> reloading the whole page?
>  
> Right now, my JavaScript layer ordering code returns a string with the 
> order of the layers stored in a hidden form element called 'setlayerorder'.
> In the base phtml file of my solution, I simply split this string to an 
> array which I pass to the setlayersdrawingorder function.
>  
> $layerlist = split('~~', $_REQUEST['setlayerorder'] );
>  $oApp->moMapSession->oMap->setlayersdrawingorder( $layerlist );
>  
> The amount of code in the solution starts to be large why I want to 
> minimize unnecessary reload of the page with JSAPI.
> The layer list does not need to be reloaded anymore since I simply drag 
> around the layers to wished position. Dropping the element should 
> trigger the mapserver legend ordering if the element's position has changed.
>  
> I think this approach is far more intuitive (and cool!) than having a 
> radio button with option to promote or demote the layer. If you add a 
> layer it will automatically get on top of all the others. The user might 
> have to click several times on the demote button (with page reload in 
> between) to get the layer to wished position.
>  
> Any ideas how to avoid the page reloading but still tell mapserver to 
> regenerate the map with the new legend order?
>  
> Cheers,
>  
> Carlo
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/


More information about the Chameleon mailing list