When I use the slider jquery everything works fine. But when i transfer it in the secondary options, the slider isnt rendered and the normal fields come up.

Comments

VVS’s picture

Title: Slider in Secondary Options » jQuery UI slider not working for Secondary Options

Me too.

Exploratus’s picture

same

ajwn’s picture

I have tested this and fixed this for my case however this would need to be done differently, as in address the module markup generated that causes it.

Short: JS cannot grab the parent div to then render the jQuery UI slider.

Why: The parent Div to the input is missing an ID to bind to.

Hack remedy to get working:

Change better_exposed_filters.js

 Drupal.behaviors.better_exposed_filters_slider = {
    attach: function(context, settings) {
      if (Drupal.settings.better_exposed_filters.slider) {
        $.each(Drupal.settings.better_exposed_filters.slider_options, function(i, sliderOptions) {
          // Only make one slider per filter.

         //FROM 
         // $("#" + sliderOptions.viewId + " #edit-" + sliderOptions.id + "-wrapper").once('slider-filter', function() {

        //To Class based Selector
       $(".form-item-" + sliderOptions.id ).once('slider-filter', function() {



            var $input = $(this).find('input[type=text]');

            // This is a "between" or "not between" filter with two values.
            if ($input.length == 2) {
              var $min = $input.parent().find('input#edit-' + sliderOptions.id + '-min'),
                  $max = $input.parent().find('input#edit-' + sliderOptions.id + '-max'),
                  default_min,
                  default_max;

              if (!$min.length || !$max.length) {
                return;
              }

Long term Solution: Change the way the markup is generated to create the right div and structure so that the slider renders inside the block.

mikeker’s picture

Issue summary: View changes
Status: Active » Fixed

Issue queue cleanup... My apologies for taking so long to address this issue!

  • mikeker committed f3c1155 on 7.x-3.x
    Issue #2002062: jQuery UI slider not working for Secondary Options
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.