ux/FlipCounter.js
[roojs1] / ux / FlipCounter.js
index 050b6ca..15a16ba 100644 (file)
@@ -5,7 +5,7 @@ Roo.ux.FlipCounter = function(options)
     Roo.apply(this, options);
     //this.el = $(element);
     //this.options = $.extend({}, defaults, options);
-     this.addEvents({
+    this.addEvents({
         // raw events
         /**
          * @event flip
@@ -46,7 +46,7 @@ Roo.extend(Roo.ux.FlipCounter, Roo.bootstrap.Component, {
         };
     },
         
-    init : function ()
+    initEvents : function ()
     { 
         var startNum = ""+ this.startnumber;
         
@@ -56,7 +56,8 @@ Roo.extend(Roo.ux.FlipCounter, Roo.bootstrap.Component, {
         }
     },
     
-    addDigit : function (num) {
+    addDigit : function (num)
+    {
         // Add separator after every 3rd digit
         if (this.digits.length % 3 == 0 && this.digits.length != 0)
         {
@@ -65,11 +66,11 @@ Roo.extend(Roo.ux.FlipCounter, Roo.bootstrap.Component, {
         
          
         
-        var li = this.el.select('li'.true).first();
-        var digit = new Roo.ux.FlipCounter.Digit(li, num);
+        
+        var digit = new Roo.ux.FlipCounter.Digit({ manager : this, currentNumber : num });
         digit.manager = this;
         this.digits.push(digit);
-        this.digit.render(this.el);
+        digit.render(this.el);
          
         // Update width
         this.ulWidth = this.ulWidth + digit.el.getWidth(true);
@@ -144,13 +145,15 @@ Roo.extend(Roo.ux.FlipCounter, Roo.bootstrap.Component, {
 
 Roo.ux.FlipCounter.Digit = function(options)
 {
-    //Roo.apply(this, options);
+    Roo.apply(this, options);
     
     this.currentNumber = this.parseInt(this.currentNumber);
+    
 }
 
 Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
 
+    manager : null, // the flipcounter... 
     currentNumber : 0,
     targetNum : 0,