Querytable: searchbar more visible
[unfold.git] / plugins / querytable / static / js / querytable.js
index 15ee6f1..b182a1a 100644 (file)
@@ -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
                 //manifold.raise_event(self.options.query_all_uuid, FIELD_REMOVED, field);
                 self.hide_column(field);
             });
+            $(".dataTables_filter").append("<div style='display:inline-block;height:27px;width:27px;padding-left:6px;padding-top:4px;'><span class='glyphicon glyphicon-search'></span></div>");
+            $(".dataTables_filter input").css("width","100%");
+            $(".columns_selector").append("columns");
+            $(".columns_selector").css("float","right");
+            $(".columns_selector").css("width","inherit");
         }, // initialize_table
 
         /**
         {
             // Remove corresponding filters
             this.filters = $.grep(this.filters, function(x) {
-                return x != filter;
+                return x == filter;
             });
             this.redraw_table();
         },
             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:
                 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;