This is a migrated thread and some comments may be shown as answers.

Endless scroll won't work on GET twitter user_timeline!

0 Answers 60 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 23 Oct 2012, 12:25 PM
Hi,

I'm trying to get a user's timeline from twitter and display it in a list view. Currently I have a list view that displays the first 10 tweets in a user's timeline. However the endless scrolling feature doesn't work! No animation is shown when you get to the bottom of the page and no call to twitter is made via http request either (I have looked using wireshark). Below is my source code:

function loadTwitterFeed() {
    var dataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: "http://api.twitter.com/1/statuses/user_timeline.json", // the remove service url
                dataType: "jsonp" // JSONP (JSON with padding) is required for cross-domain AJAX
            },
            parameterMap: function(options) {
                return {
                    screen_name: "USER_NAME",
                    count: 10,
                    since_id: options.since_id, //additional parameters sent to the remote service
                    max_id: options.max_id //additional parameters sent to the remove service
                };
            }
        }
    });
 
    $("#twitter-feed").kendoMobileListView({
        dataSource: dataSource,
        template: $("#twitter-template").text(),
        appendOnRefresh: true,
        pullToRefresh: true,
        //addition parameters which will be passed to the DataSource's read method
        pullParameters: function(item) { //pass first data item of the ListView
            return {
                since_id: item.id_str
            };
        },
        endlessScroll: true,
        //addition parameters which will be passed to the DataSource's next method
        endlessScrollParameters: function(firstOrigin) {
            if (firstOrigin) {
                return {
                    max_id: firstOrigin.id_str
                };
            }
        }
    });
}

It is similar to the twitter search demo but I have removed the serverPaging from the code as Twitter is getting rid of pages soon and is instead only using max_id and since_id. I've searched the documentation with no luck, it should work!

Does anybody know what's wrong?

Thanks,
Thomas

Link to twitter page on user_timeline: https://dev.twitter.com/docs/api/1/get/statuses/user_timeline

Example Json request which works when copied and pasted into browser (just replace USER_NAME with valid one): http://api.twitter.com/1/statuses/user_timeline.json?screen_name=USER_NAME&count=10

No answers yet. Maybe you can help?

Tags
ListView (Mobile)
Asked by
Thomas
Top achievements
Rank 1
Share this question
or