(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);
- }
+ /* 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;