Sha256: 7207add96e6eace4bbcdf180e65c92cd9a7302553bb154d99863ee5e38eade21

Contents?: true

Size: 1005 Bytes

Versions: 1

Compression:

Stored size: 1005 Bytes

Contents

# -----------------------------------------------------------------------------
# LIST PAGINATION
# -----------------------------------------------------------------------------

@listPagination =

  # PRIVATE ===============================================

  _bind_pagination: ->
    @lastScrollTop = 0

    @$items.scroll (e) =>
      # trigger next page loading only when scrolling to bottom
      if @lastScrollTop < e.target.scrollTop
        if ! @config.arrayStore.dataFetchLock

          listViewHeight  = @$el.height()
          listItemsHeight = 0
          @$items.children().each -> listItemsHeight += $(this).height()

          if listItemsHeight < (listViewHeight + e.target.scrollTop + 100)

            if ! @config.arrayStore.lastPageLoaded

              @_show_spinner()

              @config.arrayStore.load false,
                onSuccess: => ;
                onError:   => chr.showAlert("Can't load next page, server error 500.")

      @lastScrollTop = e.target.scrollTop




Version data entries

1 entries across 1 versions & 1 rubygems

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