[richfaces-svn-commits] JBoss Rich Faces SVN: r1976 - trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculous-js-1.6.5/src.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Aug 1 08:39:07 EDT 2007


Author: A.Skokov
Date: 2007-08-01 08:39:07 -0400 (Wed, 01 Aug 2007)
New Revision: 1976

Modified:
   trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculous-js-1.6.5/src/slider.js
Log:
NumberFormatExeption fixed

Modified: trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculous-js-1.6.5/src/slider.js
===================================================================
--- trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculous-js-1.6.5/src/slider.js	2007-08-01 12:25:50 UTC (rev 1975)
+++ trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/scriptaculous-js-1.6.5/src/slider.js	2007-08-01 12:39:07 UTC (rev 1976)
@@ -63,7 +63,7 @@
 
     // Allowed values array
     this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
-    if(this.allowedValues) {
+    if (this.allowedValues && this.allowedValues.length > 0) {
       this.minimum = this.allowedValues.min();
       this.maximum = this.allowedValues.max();
     }
@@ -105,7 +105,7 @@
     this.disabled = false;
   },
   getNearestValue: function(value){
-    if(this.allowedValues){
+    if (this.allowedValues && this.allowedValues.length > 0) {
       if(value >= this.allowedValues.max()) return(this.allowedValues.max());
       if(value <= this.allowedValues.min()) return(this.allowedValues.min());
 
@@ -120,9 +120,13 @@
       });
       return newValue;
     }
-    if(value > this.range.end) return this.range.end;
-    if(value < this.range.start) return this.range.start;
-    return value;
+    if(value > this.range.end) {
+        return this.range.end;
+    } else if(value < this.range.start) {
+        return this.range.start;
+    } else {
+        return parseInt(value);
+    }
   },
   setValue: function(sliderValue, handleIdx){
     if(!this.active) {
@@ -261,7 +265,7 @@
     this.event = event;
     this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
     if(this.initialized && this.options.onSlide)
-      this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
+      this.options.onSlide(this.values.length>1 ? this.values : this.values[0], this);
   },
   endDrag: function(event) {
     if(this.active && this.dragging) {
@@ -278,7 +282,7 @@
   },
   updateFinished: function() {
     if(this.initialized && this.options.onChange)
-      this.options.onChange(this.values.length>1 ? this.values : this.value, this);
+      this.options.onChange(this.values.length>1 ? this.values : this.values[0], this);
     this.event = null;
   }
 }
\ No newline at end of file




More information about the richfaces-svn-commits mailing list