 
     sortRef = (a,b) ->
       return -1 if a.getData().value < b.getData().value
-      return 1 if a.getData().value > b.getData().value
-      return 0
+      return  1 if a.getData().value > b.getData().value
+      return  0
     @handles.sort sortRef
 
   drawBar:->

    {maxValue, minValue, interval} = @getOptions()

    if @handles.length is 1
      @handles.first.leftLimit     = minValue
      @handles.first.rightLimit    = maxValue
    else
      for handle in @handles
        i    = @handles.indexOf(handle)
        data = handle.data

        data.leftLimit  = @handles[i-1]?.getData().value + interval or minValue
        data.rightLimit = @handles[i+1]?.getData().value - interval or maxValue 

  viewAppended:->
    @createHandles()

class KDSliderBarHandleView extends KDCustomHTMLView
  constructor:(options = {}, data = {})->
    options.cssClass  = "handle"
    options.name    or= "defaultHandle"
    data.value       ?= 0

    super options, data
