     @setCallback states[index + 1].bind @, @toggleState.bind @
 
   toggleState:(err)->
+
     {states} = @getOptions()
     nextState = states[@stateIndex + 2] or states[0]
     unless err

  triggerClick:()-> @doOnSubmit()

class KDToggleButton extends KDButtonView
  constructor:(options = {},data)->
    options = $.extend
      dataPath : null          # a JsPath String
      states   : []            # an Array of Objects in form of stateName : callback key/value pairs

        range       : loader.range    || 0.4
        speed       : loader.speed    || 1.5
        FPS         : loader.FPS      || 24

    @addSubView @loader, null, yes
    @loader.$().css position : "absolute", left : loader.left or 5, top : loader.top or 5
    @loader.hide()
  
  showLoader:->
