manifold: imprved plugin class with helpers for naming HTML tags in plugins
[myslice.git] / plugins / googlemap / googlemap.js
index 8c3c095..c9d3923 100644 (file)
@@ -12,6 +12,8 @@
 
 (function($){
 
+    var PLUGIN_NAME = 'GoogleMap';
+
     // routing calls
     jQuery.fn.GoogleMap = function( method ) {
                if ( methods[method] ) {
@@ -19,7 +21,7 @@
                } else if ( typeof method === 'object' || ! method ) {
                        return methods.init.apply( this, arguments );
                } else {
-                       jQuery.error( 'Method ' +  method + ' does not exist on jQuery.GoogleMap' );
+                       jQuery.error( 'Method ' +  method + ' does not exist on jQuery.' + PLUGIN_NAME );
                }    
     };
 
@@ -48,7 +50,7 @@
                 plugin.initialize();
 
                 /* Events */
-                $this.on('show.GoogleMaps', methods.show);
+                $this.on('show.' + PLUGIN_NAME, methods.show);
 
                 $this.set_query_handler(options.query_uuid, plugin.query_handler);
                 $this.set_record_handler(options.query_uuid, plugin.record_handler); 
@@ -69,7 +71,7 @@
                 var hazelnut = $this.data('Manifold');
 
                 // Unbind all events using namespacing
-                $(window).unbind('Manifold');
+                $(window).unbind(PLUGIN_NAME);
 
                 // Remove associated data
                 hazelnut.remove();
                 case FILTER_ADDED:
                 case FILTER_REMOVED:
                 case CLEAR_FILTERS:
-                    // XXX Here we might need to maintain the list of filters !
-                    /* Process updates in filters / current_query must be updated before this call for filtering ! */
-                    object.table.fnDraw();
                     break;
 
                 // Fields
                 /* Hide/unhide columns to match added/removed fields */
                 case FIELD_ADDED:
-                    var object = this;
-                    $.each(added_fields, function (index, field) {            
-                        var index = object.getColIndex(field,cols);
-                        if(index != -1)
-                            object.table.fnSetColumnVis(index, true);
-                    });
                     break;
                 case FIELD_REMOVED:
-                    var object = this;
-                    $.each(removed_fields, function (index, field) {
-                        var index = object.getColIndex(field,cols);
-                        if(index != -1)
-                            object.table.fnSetColumnVis(index, false);
-                    });            
                     break;
                 case CLEAR_FIELDS:
                     alert('GoogleMaps::clear_fields() not implemented');