- var PLUGIN_NAME = 'QueryEditor';
-
- // routing calls
- jQuery.fn.QueryEditor = function( method ) {
- if ( methods[method] ) {
- return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
- } else if ( typeof method === 'object' || ! method ) {
- return methods.init.apply( this, arguments );
- } else {
- jQuery.error( 'Method ' + method + ' does not exist on jQuery.' + PLUGIN_NAME );
- }
- };
-
- /***************************************************************************
- * Public methods
- ***************************************************************************/
-
- var methods = {
-
- /**
- * @brief Plugin initialization
- * @param options : an associative array of setting values
- * @return : a jQuery collection of objects on which the plugin is
- * applied, which allows to maintain chainability of calls
- */
- init : function ( options ) {
-
- return this.each(function() {
-
- var $this = $(this);
-
- /* An object that will hold private variables and methods */
- var plugin = new QueryEditor(options);
- $this.data('Manifold', plugin);
-
- $this.set_query_handler(options.query_uuid, plugin.query_handler);
- // This is used for autocomplete
- $this.set_record_handler(options.query_uuid, plugin.record_handler);
-
- }); // this.each
- }, // init
-
- /**
- * @brief Plugin destruction
- * @return : a jQuery collection of objects on which the plugin is
- * applied, which allows to maintain chainability of calls
- */
- destroy : function( ) {
-
- return this.each(function() {
- var $this = $(this);
- var plugin = $this.data('Manifold');
-
- // Unbind all events using namespacing
- $(window).unbind(PLUGIN_NAME);
-
- // Remove associated data
- plugin.remove();
- $this.removeData('Manifold');
-
- });
- }, // destroy
-
- }; // var methods;
-
- /***************************************************************************
- * Plugin object
- ***************************************************************************/
-
- function QueryEditor(options)
- {
-
- /* member variables */
- this.options = options;
-
- var object = this;
-
- this.initialize_table = function(data)
- {
-
- var d = data;