PullToRefresh argument undefined

5 posts, 0 answers
  1. Bastien
    Bastien avatar
    19 posts
    Member since:
    Mar 2010

    Posted 22 Jan 2013 Link to this post

    Hi,

    I've a problem with the 'pullToRefresh' feature of the mobile listview.
    $("#posts").kendoMobileListView({
                        pageSize: configPageSize,
                        dataSource: ds,
                        template: kendo.template($("#tmpl-post").html(), {useWithBlock:true}),
                        endlessScroll: true,
                        scrollTreshold: 30, //treshold in pixels
                        appendOnRefresh: true,
                        pullToRefresh: true,
                        pullParameters: function(item) {
                            //additional parameters
                            return {
                                since: item.CreatedOn,
                                page: 1
                            };
                        },
                        click: function(e) {
                            //writeLog($(e.target).closest('li').attr('id'));
                        }
                    });
    'item' parameter of pullParameters function is UNDEFINED. Why is this happening? Am I doing something wrong? 

    Thanks for help.
    Bastien
  2. myTeamWorks
    myTeamWorks avatar
    15 posts
    Member since:
    Jan 2013

    Posted 23 Jan 2013 Link to this post

    any idea?
  3. Kendo UI is VS 2017 Ready
  4. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 24 Jan 2013 Link to this post

    Hi,

     
    The argument passed to the pullParameters callback is the first item of the ListView. If the ListView is empty then the item can be undefined. I will suggest you check whether the item exists:

    pullParameters: function(item) {
        var CreatedOn;
        if (item) {
             CreatedOn = item.CreatedOn;
        }
     
        return {
             since: CreatedOn,
             page: 1
        };
    },

    Kind regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. myTeamWorks
    myTeamWorks avatar
    15 posts
    Member since:
    Jan 2013

    Posted 24 Jan 2013 Link to this post

    Hi Georgi,

    Thanks for your answer but my ListView is not empty and item is still undefined.

    I think I've some problem with the DataSource because if I do this:
    $("#posts").data("kendoMobileListView").items(0)
    I can see all the items in my listview.

    BUT, if I do this:
    $("#posts").data("kendoMobileListView").dataSource.get(0);
    it returns nothing. Even .dataSource.Total() returns 0...

    How can the DataSource be empty and not the listview?

    Thanks for help.
    Bastien
  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 25 Jan 2013 Link to this post

    Hello again,

     
    The items method returns all LI elements of the ListView and does not accept any parameters. I will need a simple test page (jsBin/jsFiddle), which replicates the issue. Thus I will be able to investigate the problem and advice you further.

    Regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready