TechQA.

ion range slider and modal: how to populate to and from before modal is shown

306 views Asked by Santhosh At 2021-02-28T13:23:01+00:00 28 February 2021 at 13:23 2025-12-22T18:41:13+00:00

I am using ionrangeslider in a modal

<!-- The Modal -->
<div class="modal" id="myModal">
    <div class="modal-dialog modal-dialog-centered">
      <div class="modal-content" style="width: auto;margin: 0 auto">

        <!-- Modal body -->
        <div class="modal-body">
            <input type="text" id="mySlider"/>
        </div>

      </div>
    </div>
</div>

I get some values from ajax and after that i set the to and from for the slider like

$(document).ready(function () {

    $('#mySlider').ionRangeSlider({
        grid: false,
        type: 'double',
        min: 1,
        max: 10,
        force_edges: true,
        drag_interval: true,
        step: 1,
    });

    $.ajax({
        url: "/get_schedule_for_zone/",
        type: 'POST',
        headers: { 'X-CSRFToken': csrftoken },
        data: {"deviceassigned_id":  parseInt(deviceassigned_id),"zone_number": parseInt(zone_number)},
        success: function(res) {
            $('#mySlider').data("ionRangeSlider").update({from: res.to})
            $('#mySlider').data("ionRangeSlider").update({to: res.from})
            $('$myModal').modal('show')
        },
        error : function(xhr,errmsg,err) {
            console.log(err)
        }
    })


})

what i found it the modal open and then shows the slider without to and from, and then updated the to and from. the user can see that they are changing from nothing to some values

how to set them before i open the modal and show them there.

ion-range-slider
Original Q&A
1

There are 1 answers

0
Frenchy Frenchy On 2021-03-10T15:20:34+00:00 10 March 2021 at 15:20

if your slider is inside a div, just hide it:

<div id="slider">
<input type="text" class="js-range-slider" id="test" name="my_range" value=""
                            data-min="40"
                            data-max="210"
                            data-from="{{row2.7}}"
                            data-grid="true"
                            data-hide-min-max="true"
                            data-postfix="'F"
                            data-type="double"
                        />

</div>


$("#slider").hide();

and after displaying you modal, (or just before)

 $("#slider").show();

other solution is to play with opacity

Related Questions in ION-RANGE-SLIDER

  • ION Range Slider triggering multiple times If axios is used
  • Can I disable changing value of ion-range by touching line, and only for knobs?
  • why vue-range-component is not working fine in sweet-modal Vuejs
  • Changing pin format to date in Ion Range Ionic 5
  • ion-rangeSlider time formate issue
  • Ionic Range dual knob settings initial values and update dynamically
  • Rails 7 failing to import yarn package (https://github.com/keisto/vanilla-rangeslider)
  • Ionic : Issue with <ion-range>
  • ACF custom field type not appearing on backend - jQuery error on ion range slider
  • Put yellow dot inside the ion-range slider knob
  • IonRange Slider onUpdate transition
  • Ion RangeSlider custom function for slider val?
  • Ion RangeSlider without jQuery
  • How to place a function inside a Class?
  • Horizontal scrollbar displayed because absolute positioned elements

Popular Questions

  • How do I undo the most recent local commits in Git?
  • How can I remove a specific item from an array in JavaScript?
  • How do I delete a Git branch locally and remotely?
  • Find all files containing a specific text (string) on Linux?
  • How do I revert a Git repository to a previous commit?
  • How do I create an HTML button that acts like a link?
  • How do I check out a remote Git branch?
  • How do I force "git pull" to overwrite local files?
  • How do I list all files of a directory?
  • How to check whether a string contains a substring in JavaScript?
  • How do I redirect to another webpage?
  • How can I iterate over rows in a Pandas DataFrame?
  • How do I convert a String to an int in Java?
  • Does Python have a string 'contains' substring method?
  • How do I check if a string contains a specific word?

Trending Questions

  • UIImageView Frame Doesn't Reflect Constraints
  • Is it possible to use adb commands to click on a view by finding its ID?
  • How to create a new web character symbol recognizable by html/javascript?
  • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
  • Heap Gives Page Fault
  • Connect ffmpeg to Visual Studio 2008
  • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
  • How to avoid default initialization of objects in std::vector?
  • second argument of the command line arguments in a format other than char** argv or char* argv[]
  • How to improve efficiency of algorithm which generates next lexicographic permutation?
  • Navigating to the another actvity app getting crash in android
  • How to read the particular message format in android and store in sqlite database?
  • Resetting inventory status after order is cancelled
  • Efficiently compute powers of X in SSE/AVX
  • Insert into an external database using ajax and php : POST 500 (Internal Server Error)
  • Privacy
  • Terms
  • Cookies
  • Homegardensmart
  • Math
  • Aftereffectstemplates