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

PullToRefresh argument undefined

4 Answers 43 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Bastien
Top achievements
Rank 1
Bastien asked on 22 Jan 2013, 12:55 PM
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

4 Answers, 1 is accepted

Sort by
0
myTeamWorks
Top achievements
Rank 1
answered on 23 Jan 2013, 11:12 AM
any idea?
0
Georgi Krustev
Telerik team
answered on 24 Jan 2013, 07:55 AM
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!
0
myTeamWorks
Top achievements
Rank 1
answered on 24 Jan 2013, 08:44 AM
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
0
Georgi Krustev
Telerik team
answered on 25 Jan 2013, 09:11 AM
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!
Tags
ListView (Mobile)
Asked by
Bastien
Top achievements
Rank 1
Answers by
myTeamWorks
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or