fixing search widget on list view template
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 14 Apr 2017 19:45:30 +0000 (15:45 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 14 Apr 2017 19:45:30 +0000 (15:45 -0400)
adding javascript to preserve both the brands and manufacturers when searching the
list view template file

glm-member-db/views/front/members/list.html

index f608c61..5b53f8c 100644 (file)
             $(this).css("display", "block");
 
         });
-        //         var cat_ids     = [];
-//        $.fn.manufacturer_brand = function(){
-//
-//            $(this).on("change", function(){
-//                var _ = $(this);
-//
-//                var cat_names   = [];
-//                var cat_id      = _.val();
-//                var el_id       = _.attr('id');
-//                var cats        = _.prev().find('span');
-//
-//                cat_ids.push(cat_id);
-//
-//                cats.each(function(){
-//                    cat_names.push(_.text());
-//                });
-//
+$(window).on("load", function(){
+    
+
         var cat_ids     = [];
         var selected_brands = [];
         var all_brands  = '{$brands|@json_encode}';
                     $("#rvManufacturers").prev().prev().prop("disabled",false);
                 }
         });
+         console.log($('#rvManufacturers').find(":selected").length);
+        if(  $('#rvManufacturers').find(":selected").length > 0 ){
 
-        if( $('#rvManufacturers').prev().children('li').length > 0 ){
-         
             var brand_ids = $('#brands').val();
       
             $('#brands option').remove();  
            
             var brands      = [];
-            var cat_id = $('#rvManufacturers').val();
-
+            var cat_id      = $('#rvManufacturers').val();
+            
             $.each(cat_id, function(index, item){
                 var select_id = item;
                 $.each(categories , function(index, item){
                    }
                 });
             });
+            
             var searched_brand;
-
+           
             $.each(brands, function(index, item){
                 
                 if( $.inArray(item.id, brand_ids) === 0){
-                    console.log("Test");
+          
                     searched_brand = true;   
                 } else {
-                    console.log("test");
+           
                     searched_brand = false;   
                 }
                 
 
             $('#brands').prev().prev().remove();
             $('#brands').prev().remove();
-        } 
+        }
 
     jQuery('select[multiple]').asmSelect();
+        });
 
             // Show search filters box
             {if $settings.list_show_search}