Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

_this.listView.refresh is not a function #4

Closed
ngydat opened this issue Apr 4, 2016 · 3 comments
Closed

_this.listView.refresh is not a function #4

ngydat opened this issue Apr 4, 2016 · 3 comments

Comments

@ngydat
Copy link

ngydat commented Apr 4, 2016

Hi @bradmartin ,
For my internship I've been asked to develop a mobile application with Nativescript and Angular 2.
One of the things the app should be able to do is to get the notiffications (which I store in a listview in my app); Obviously i'd like to add the possibility to refresh the list of notifications by pulling down but even though I follow the instructions, I get this error (the one you see as the title of my post).

Here's the view :
<TabView> <StackLayout *tabItem="{title: 'Accueil'}"> </StackLayout> <StackLayout *tabItem="{title: 'Notifications'}"> <PullRefresh:PullToRefresh refresh="refreshList"> <ListView [items]="notificationsList"> <template #item="item"> <Label text="{{item.text}}" textWrap="true" id="notif" [class.boldFont]="!item.status"></Label> </template> </ListView> </PullRefresh:PullToRefresh> </StackLayout> </TabView>

and the refreshlist method I use in a Typescript file :

refreshList(args) { let pullRefresh = args.object; this._notificationService.load() .toPromise() .then(resp => { setTimeout(() => { pullRefresh.refreshing = false; }, 1000); }, err => { pullRefresh.refreshing = false; }); }

@bradmartin
Copy link
Collaborator

@ngydat - I don't think that's an issue with the plugin. I'm not a TS expert by any means but why is your error _this.listView.refresh? In this plugin refresh is the event for the PullToRefresh component and not the listview. So just from quickly skimming your code and the error I think your TS code isn't referencing the correct object for your event. Try debugging the event and see what _this. is and also that args.object is the PullToRefresh component when executed.

@matt4446
Copy link
Contributor

matt4446 commented Apr 5, 2016

Plugin integration - NativeScript/nativescript-angular#157 - I might add the list view to my test page tomorrow.

just updating the component's notificationsList should be enough to cause the listview to update. (I have never used the list control in nativescript-angular though). I would need to see the entire page component to see what you are up to.

I would recommend looking at these two:

If there are any problems then its more likely to do with the nativescript-angular implementation.

@bradmartin
Copy link
Collaborator

Any issues let me know 👍 - Cleaning things up.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants