X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=inline;f=plugins%2Fquerytable%2Fstatic%2Fjs%2Fquerytable.js;h=b182a1aaa4057b0b30ad582d6679bcc1692ffce4;hb=d7e386318945be3df497f1f6b2ed78d00e9f0c37;hp=bcb8192750aaeb8394bc6d89b4ac5988231e13f2;hpb=6a21b460f2ef205cadcf95bcd724e06523c394bf;p=unfold.git diff --git a/plugins/querytable/static/js/querytable.js b/plugins/querytable/static/js/querytable.js index bcb81927..b182a1aa 100644 --- a/plugins/querytable/static/js/querytable.js +++ b/plugins/querytable/static/js/querytable.js @@ -7,12 +7,12 @@ (function($){ var debug=false; - debug=true +// debug=true var QueryTable = Plugin.extend({ - init: function(options, element) - { + init: function(options, element) { + this.classname="querytable"; this._super(options, element); /* Member variables */ @@ -91,7 +91,8 @@ var actual_options = { // Customize the position of Datatables elements (length,filter,button,...) // we use a fluid row on top and another on the bottom, making sure we take 12 grid elt's each time - sDom: "<'row'<'col-xs-5'l><'col-xs-1'r><'col-xs-6'f>>t<'row'<'col-xs-5'i><'col-xs-7'p>>", + //sDom: "<'row'<'col-xs-5'l><'col-xs-1'r><'col-xs-6'f>>t<'row'<'col-xs-5'i><'col-xs-7'p>>", + sDom: "<'row'<'col-xs-5'f><'col-xs-1'r><'col-xs-6 columns_selector'>>t<'row'<'col-xs-5'l><'col-xs-7'p>>", // XXX as of sept. 2013, I cannot locate a bootstrap3-friendly mode for now // hopefully this would come with dataTables v1.10 ? // in any case, search for 'sPaginationType' all over the code for more comments @@ -145,6 +146,11 @@ //manifold.raise_event(self.options.query_all_uuid, FIELD_REMOVED, field); self.hide_column(field); }); + $(".dataTables_filter").append("
"); + $(".dataTables_filter input").css("width","100%"); + $(".columns_selector").append("columns"); + $(".columns_selector").css("float","right"); + $(".columns_selector").css("width","inherit"); }, // initialize_table /** @@ -207,8 +213,20 @@ else line.push(record['hostname']); - } else if (colnames[j] == 'hrn' && typeof(record) != 'undefined') { - line.push(' '+record['hrn']); + } else if (colnames[j] == this.init_key && typeof(record) != 'undefined') { + obj = this.object + o = obj.split(':'); + if(o.length>1){ + obj = o[1]; + }else{ + obj = o[0]; + } + /* XXX TODO: Remove this and have something consistant */ + if(obj=='resource'){ + line.push(' '+record[this.init_key]); + }else{ + line.push(' '+record[this.init_key]); + } } else { if (record[colnames[j]]) line.push(record[colnames[j]]); @@ -288,7 +306,7 @@ { // Remove corresponding filters this.filters = $.grep(this.filters, function(x) { - return x != filter; + return x == filter; }); this.redraw_table(); }, @@ -403,7 +421,7 @@ switch(data.request) { case FIELD_REQUEST_ADD: case FIELD_REQUEST_ADD_RESET: - this.set_checkboxfrom_data(data.value, true); + this.set_checkbox_from_data(data.value, true); break; case FIELD_REQUEST_REMOVE: case FIELD_REQUEST_REMOVE_RESET: @@ -478,6 +496,15 @@ if (op == '=' || op == '==') { if ( col_value != value || col_value==null || col_value=="" || col_value=="n/a") ret = false; + }else if (op == 'included') { + $.each(value, function(i,x) { + if(x == col_value){ + ret = true; + return false; + }else{ + ret = false; + } + }); }else if (op == '!=') { if ( col_value == value || col_value==null || col_value=="" || col_value=="n/a") ret = false;