EasyUI Forum
December 19, 2025, 06:13:35 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to change options (e.g., min, max) on the fly in the slider?  (Read 16268 times)
kudoof
Newbie
*
Posts: 21


View Profile
« on: March 17, 2013, 08:38:54 AM »

 I wanted to change the min/max options of a slider when user enters a new value for the min/max, but in the documentation of easyui, its method 'option' only gets options and can not set. I also tried the following, but still did not work  Cry:
Code:
$("#min")[0].addEventListener("input", function(){
var v = $("#min").val();
if (v <= 5 ) { 
    $("#myslider").slider('destroy').end().slider({ 
        width: 300,
        mode: 'h',
        showTip: true,
        value: 5,
        min: v, 
        max: 10
    });
}
else {
     alert("out of bound(1-5): " + v);
}
}, false);
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: March 17, 2013, 07:59:28 PM »

Please refer to this example http://jsfiddle.net/68Z7D/ that shows how to change 'min' property value on slider.
Logged
kudoof
Newbie
*
Posts: 21


View Profile
« Reply #2 on: March 17, 2013, 10:47:32 PM »

Exactly what I needed. Thanks!!!!
Logged
kudoof
Newbie
*
Posts: 21


View Profile
« Reply #3 on: April 16, 2013, 06:03:01 PM »

I found a subtle problem in the way I use it.  Changing the max is okay, but changing the min will cause the slider to malfunction.  I had to use min: Number(v) to make it work.

here:
http://jsfiddle.net/cFBVe/
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: April 16, 2013, 08:11:46 PM »

Please download the updated slider plugin from http://www.jeasyui.com/easyui/plugins/jquery.slider.js to solve this issue.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!