imported the whole jquery-ui package, refreshed with 1.10.2
[unfold.git] / plugins / lists / simplelist.js
index 6fdb4c3..46534ce 100644 (file)
@@ -10,7 +10,7 @@
 (function($){
 
     var debug=false;
-    //debug=true
+    // debug=true
 
     $.fn.SimpleList = function( method ) {
         /* Method calling logic */
        init : function( options ) {
            return this.each(function(){
                var $this = $(this), data = $this.data('SimpleList');
-               // If the plugin hasn't been initialized yet
-               if ( ! data ) {
-                   /* Subscribe to query updates */
-                   var channel='/results/' + options.query_uuid + '/changed';
-                   /* passing $this as 2nd arg: callbacks will retrieve $this as e.data */
-                   $.subscribe(channel, $this, update_plugin);
-                   if (debug) window.console.log('subscribing to ' + channel);
-                   $this.data('SimpleList', {options: options});
-               }
+               /* Subscribe to query updates */
+               var channel='/results/' + options.query_uuid + '/changed';
+               /* passing $this as 2nd arg: callbacks will retrieve $this as e.data */
+               $.subscribe(channel, $this, update_plugin);
+               if (debug) window.console.log('subscribing to ' + channel);
+               $this.data('SimpleList', options);
            });
        },
        destroy : function( ) {
        $plugindiv.closest('.need-spin').spin(false);
 
         if (rows.length == 0) {
-           if (use_datatables) datatables_set_message ("No result");
-           else                regular_set_message ("No result");
+           if (use_datatables) datatables_set_message ($table, $tbody, unfold.warning("No result"));
+           else                regular_set_message ($table, $tbody, unfold.warning("No result"));
             return;
         }
         if (typeof rows[0].error != 'undefined') {
            var error="ERROR: " + rows[0].error;
-           if (use_datatables) datatables_set_message (error);
-           else                regular_set_message (error);
+           if (use_datatables) datatables_set_message ($table, $tbody, unfold.error(error));
+           else                regular_set_message ($table, $tbody, unfold.error(error));
             return;
         }
-        var options = $plugindiv.data().SimpleList.options;
+        var options = $plugindiv.data().SimpleList;
        if (use_datatables)     datatables_update_table ($table,$tbody,rows,options.key);
        else                    regular_update_table ($table,$tbody,rows,options.key);