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

Incremental TableView model update using Alloy Backbone data-binding

$
0
0

hi, I am using Alloy for my project.

I have a TableView that displays list of message updates. The data feed for the table is bound via a custom Alloy sync adapter which in turn is connected to a REST web server. The TableView does not have a local persistent storage (no local sqllite db) and retrieves all data via the custom sync adapter & Backbone.js Alloy paradigm.

I use collection.fetch() to retrieve new data feed from the server. The server sends incremental or new data feed since the last 'pull' by the client. I would like this incremental data feed to be added to TableView. However currently the sync adapter & Backbone.js replaces the existing data models with the new incremental data feed received.

What is the recommended way to incrementally add new data models to backbone.js collection & the TableView (& not replace existing data models)? My fetch method is shown below. I have also added 'removed: false' thinking that this should prevent existing data models from being removed... but it hasnt helped.

Appreciate any feedback... thanks!

my_collection.fetch(
            {wait: true,
            remove: false,      // Do not remove existing data models?
            merge: true,        // Merge with existing data models?
 
            success: function(model, model_str, options) {
                callback_success();
 
            }, 
            error: function(model, err_str, options) {
                callback_error();
            }, 
            }
        );
Snippet from my sample TableView that binds to the collection/data models:
<Alloy>
<Collection src="my_collection"/>
 
<TableView dataCollection="my_collection">
    <Label id="feed_username" text="{user_name}"/>
    <Label id="feed_status" text="{feed_status}"/>
</TableView>
</Alloy>

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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