- initialize_plugin(jQuery(this).data());
-
- function update_options(e, rows){
- var d = data;
- var availableTags={};
- jQuery.each (rows, function(index, obj) {
- jQuery.each(obj,function(key,value){
- value = get_value(value);
- if(!availableTags.hasOwnProperty(key)){availableTags[key]=new Array();}
- //availableTags[key].push(value);
- var currentArray=availableTags[key];
- if(value!=null){
- if(jQuery.inArray(value,currentArray)==-1){availableTags[key].push(value);}
- }
- });
- });
- jQuery.each(availableTags, function(key, value){
- value.sort();
- if(jQuery("#"+options.plugin_uuid+"-select_"+key).length>0){
- jQuery.each(value, function(k, optValue){
- jQuery("#"+options.plugin_uuid+"-select_"+key).append('<option>'+optValue+'</option>');
- });
- }
- if(jQuery("#QuickFilter-string-"+key).length>0){
- jQuery("#QuickFilter-string-"+key).autocomplete({
+ var methods = {
+
+ init : function( options ) {
+ return this.each(function(){
+
+ var $this = $(this),
+ data = $this.data('QuickFilter'), QuickFilter = $('<div />', {text : $this.attr('title')});
+
+ if ( ! data ) {
+
+ data = $(this).data();
+
+ /* Subscribe to selection updates published by the resource display plugins */
+ //$.subscribe('selected', {instance: $this}, resource_selected);
+ $.subscribe('/query/' + options.query_uuid + '/changed', {instance: $this}, query_changed);
+
+
+ /* End of plugin initialization */
+
+ $(this).data('QuickFilter', {
+ plugin_uuid: options.plugin_uuid,
+ query_uuid: options.query_uuid,
+ target : $this,
+ QuickFilter : QuickFilter
+ });
+
+ $(this).data('current_query', null);
+
+ initialize_plugin($(this).data());
+
+ function update_options(e, rows){
+ var d = data;
+ var availableTags={};
+ $.each (rows, function(index, obj) {
+ $.each(obj,function(key,value){
+ value = get_value(value);
+ if(!availableTags.hasOwnProperty(key)){availableTags[key]=new Array();}
+ //availableTags[key].push(value);
+ var currentArray=availableTags[key];
+ if(value!=null){
+ if($.inArray(value,currentArray)==-1){availableTags[key].push(value);}
+ }
+ });
+ });
+ $.each(availableTags, function(key, value){
+ value.sort();
+ if($("#"+options.plugin_uuid+"-select_"+key).length>0){
+ $.each(value, function(k, optValue){
+ $("#"+options.plugin_uuid+"-select_"+key).append('<option>'+optValue+'</option>');
+ });
+ }
+ if($("#QuickFilter-string-"+key).length>0){
+ $("#QuickFilter-string-"+key).autocomplete({