Comments (12)
Are you using this.numItems anywhere in the view?
from nativescript-pager.
yes, I use this to calculate the number of pages and to change the buttons that are displayed in the view
<GridLayout row="3" rows="auto" columns="*, *" class="main-activity">
<Button text="Prev" (tap)="prevPage()" class="btn btn-primary" col="0" *ngIf="latestReceivedIndex != 0"></Button>
<Button text="Next" (tap)="nextPage()" class="btn btn-primary" col="1" *ngIf="latestReceivedIndex != (numItems-1)"></Button>
<Button text="Save" (tap)="saveForms()" class="btn btn-primary" col="1" *ngIf="latestReceivedIndex == (numItems-1)"></Button>
</GridLayout>
from nativescript-pager.
So it’s the buttons that doesn’t update no?
from nativescript-pager.
no, the problem is not the buttons, the problem is when I insert an object in the middle of two pages, the new object it is shown in another part or with wrong information (usually duplicates the last page) and when I delete an object always removes me the last page. however when I review the BehaviorSubject object in the console, this is fine but in the view not and this only happens in ios.
from nativescript-pager.
Can you try calling .refresh(true) on the pager after you update it ?
from nativescript-pager.
@triniwiz
I think I have same problem #66
When I use unshift in items, it update wrong data in Pager.
from nativescript-pager.
I have items = [1, 2, 3], Pager show 3 page, it ok.
I use items.unshift(0); this.pager.nativeElement.refresh(true) ;
console.log(items) => [0, 1, 2, 3]
But Pager show data: 0 - 1 - 3 - 3
from nativescript-pager.
it still doesn't work @triniwiz and @HoangJK it's the same error
from nativescript-pager.
if I refresh the items as shown in the code below, it works, but the UX is ugly, because the previous page is first displayed and then the new page.
for example if I have items = [1,2,3]
and I update it to items = [1,2, new, 3]
First he shows me page 3 and after a few seconds the new page is shown, which makes the user thing as an error.
prevPage() {
this.pager.nativeElement.refresh(true);
const newIndex = Math.max(0, this.currentPagerIndex - 1);
this.currentPagerIndex = newIndex;
this.pager.nativeElement.selectedIndex = newIndex;
}
// Go to the next page
nextPage() {
this.pager.nativeElement.refresh(true);
const newIndex = Math.min(this.numItems - 1, this.currentPagerIndex + 1);
this.currentPagerIndex = newIndex;
this.pager.nativeElement.selectedIndex = newIndex;
}
// Change de Index of the page
onIndexChanged($event) {
this.pager.nativeElement.refresh(true);
this.latestReceivedIndex = $event.value;
this.currentPagerIndex = $event.value;
}
addQuestion() {
let newItems = (<BehaviorSubject>this.formItems).value;
newItems.splice(indexPage+1, 0, newQuestion);
this.formItems.next(newItem);
this.pager.nativeElement.refresh(true);
}
from nativescript-pager.
Thanks for the info 😃
from nativescript-pager.
Can you try the latest version :)
from nativescript-pager.
This is fixed in the latest release
from nativescript-pager.
Related Issues (20)
- iOS orientation issue using Pager + HtmlView HOT 3
- Vue Template Selector HOT 1
- iOS: item snap does not work while swiping when using tns-ios-v8-beta HOT 6
- iOS Image pager jerked when I swipe left HOT 4
- Changing a property on nested object causes ordering problems HOT 6
- iOS indicator color is not applied HOT 3
- Add vertical and horizontal orientation at the same time HOT 2
- Pager discards global context
- Error angular 9.1.0 HOT 3
- Angular 10 @nativescript-community/ui-pager 13.0.0-alpha.5 module import is not working HOT 2
- @nativescript-community/ui-pager":"^13.0.0-alpha.7 - Error - cant resolve - element-registry, lang-facade HOT 3
- Error: Can't resolve '@nativescript/core/data/observable-array/observable-array' Nativescript 7 HOT 3
- 13.0.0-alpha.10 crash with transformers="scale"
- selectedIndexChange value is undefined.
- Just Programatically Control HOT 1
- Feature Request: Revamping swipeEnd events HOT 1
- Unshift + selectedIndex bugged HOT 8
- 3 Pages in one view HOT 1
- Textview keyboard dismisses after one key tap.
- Build error on NS 8.4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-pager.