Sha256: 86a3ff8e0d6a148b75008d2b9917d4c576be8fb4fc68f43f83cda93556cee65e

Contents?: true

Size: 937 Bytes

Versions: 2

Compression:

Stored size: 937 Bytes

Contents

# -----------------------------------------------------------------------------
# LIST PAGINATION
# todo:
#  - trigger onScroll event only when scrolling down
# -----------------------------------------------------------------------------

@listPagination =
  # PRIVATE ===============================================

  _bind_pagination: ->
    arrayStore = @config.arrayStore
    @$items.scroll (e) =>
      if ! arrayStore.dataFetchLock
        # TODO: update this logic as it's not reliable when items has different height
        $listChildren        = @$items.children()
        listChildrenCount    = $listChildren.length
        listFirstChildHeight = $listChildren.first().outerHeight()
        listHeight           = listChildrenCount * listFirstChildHeight
        viewHeight           = @$el.height()

        if listHeight < (viewHeight + e.target.scrollTop + 100)
          @_show_spinner()
          arrayStore.load()




Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chr-0.2.5 app/assets/javascripts/chr/core/list_pagination.coffee
chr-0.2.4 app/assets/javascripts/chr/core/list_pagination.coffee