ThinkGeo.com    |     Documentation    |     Premium Support

Conditional ontrackshapefinished

Is there a way to make, ontrackshapefinished event, conditional? For example, for a DrawMode rectangle, I only want to process client-side script; for DrawMode, Line, I want process server-side ontrackshapefinished even. Is this possible? Please advise



Ttd,  
  
 You can implement it in this way.  
  
 
        var trackShapeEnd = function(feature) {
            var geoType = feature.geometry.CLASS_NAME;
            switch (geoType) {
                case ‘OpenLayers.Geometry.LineString’:
                    alert(‘trigger client events here.’);
                    break;
                case ‘OpenLayers.Geometry.Polygon’:
                    alert(‘trigger sever events here.’);
                    break;
                default:
                    alert(‘trigger other events here.’);
                    break;
            }
        }
 
  
 You can directly call a client side method here. Also you can implement the IpostBackEventHandler interface and use __doPostBack on client side to raise the server side methods, Remember you do not need to hook up the server side event, just use __doPostBack and the corresponding Server method will be called. 
  
 Thanks, 
  
 Ben