Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Detecting added tablerows completion after postlayout

$
0
0

Hey,

I'm looking for a solution on the following problem:

I've built an endless scroll feature, which adds 15 rows (1 page) to a TableView when a user reaches the bottom of the screen. However, there appear to be some bugs with the implementation since rows are being added before the previous page has been fully appended.

A stripdown of the implementation:

$.table_view.addEventListener('scroll', function() {
    if(loading) {
       return;
    }
    loading = true;
    Alloy.Globals.API.request('rows', function(err, value) {
        //this is the asynchronous callback which gets called on request completion
        $.table_view.setData(value);
        loading = false;
    });
It boils down to the problem that it sets loading=false too quickly, before the rows are added. I'm looking for a postlayout-like solution where I can set loading to false after all rows have been succesfully added, but that event only fires once, being on page load. Adding rows or setting data does not seem to trigger a postlayout event so I cant know for sure if the view has completed loading.

Any known solutions or perhaps known issues with this postlayout event?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>