Skip to content

Commit

Permalink
fix(occlusion): wire up onScroll and onScrolledToBottom
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Nov 24, 2017
1 parent b93f067 commit ee30bb8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
18 changes: 18 additions & 0 deletions addon/components/lt-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,24 @@ export default Component.extend({
*/
onScrolledToBottom() {
this.sendAction('onScrolledToBottom');
},

firstVisibleChanged(item, index /* , key */) {
const estimateScrollOffset = index * this.get('sharedOptions.estimatedRowHeight');
this.sendAction('onScroll', estimateScrollOffset, null);
},

lastVisibleChanged(/* item, index, key */) {
this.sendAction('lastVisibleChanged', ...arguments);
},

firstReached(/* item, index, key */) {
this.sendAction('firstReached', ...arguments);
},

lastReached(/* item, index, key */) {
this.sendAction('lastReached', ...arguments);
this.sendAction('onScrolledToBottom');
}
}
});
9 changes: 4 additions & 5 deletions addon/templates/components/lt-body.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
estimateHeight=sharedOptions.estimatedRowHeight
bufferSize=scrollBufferRows
containerSelector='.lt-scrollable'
firstVisibleChanged=(action 'firstVisibleChanged')
lastVisibleChanged=(action 'lastVisibleChanged')
firstReached=(action 'firstReached')
lastReached=(action 'lastReached')
as |row index|
}}
{{lt.row row columns
Expand Down Expand Up @@ -114,11 +118,6 @@
</tbody>
</table>

{{!--#if onScrolledToBottom}} TODO figure out how to use the scrollbuffer property for infinite loading
lastReached=onScrolledToBottom
{{lt.infinity rows=rows onScrolledToBottom=onScrolledToBottom scrollBuffer=scrollBuffer}}
{{/if --}}

<div id="{{concat tableId '_inline_foot'}}" class="lt-inline lt-foot"></div>
</div>
{{/unless}}
Expand Down

0 comments on commit ee30bb8

Please sign in to comment.