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

Carlo Tronnberg temp at chello.hu
Mon Jun 19 10:15:16 EDT 2006


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060619/f8c0a403/attachment.html


More information about the Chameleon mailing list