You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I have an ObservableArray that is first initialized with null values. Then when the index of the pager is changed I'm loading data from the backend and replacing the null value with the appropriate Observable model object for the view. I'm having 2 different templates - one that is for null object and one for non-null objects. After the data is loaded and I replace the null object it still shows the blank template for the item. From what I've traced this is due to two problems:
The code in the instantiateItem does not take into consideration the template, it is just based by index:
This can easily be fixed by instead using just the position to use ${position}-${template.key} as the key for the cached view map.
(The bigger one) Although when an item in the ObservableArray is changed the refres() methos is correctly called but the adapter's notifyDataSetChanged() does not cause the views to be regenerated. So basically it does nothing... You can read more about the possible solutions here: https://stackoverflow.com/a/7287121/5272836.
The text was updated successfully, but these errors were encountered:
So I have an
ObservableArray
that is first initialized withnull
values. Then when the index of the pager is changed I'm loading data from the backend and replacing thenull
value with the appropriateObservable
model object for the view. I'm having 2 different templates - one that is fornull
object and one for non-null objects. After the data is loaded and I replace thenull
object it still shows the blank template for the item. From what I've traced this is due to two problems:instantiateItem
does not take into consideration the template, it is just based by index:nativescript-pager/src/pager.android.ts
Lines 304 to 312 in 558f1b2
This can easily be fixed by instead using just the
position
to use${position}-${template.key}
as the key for the cached view map.ObservableArray
is changed therefres()
methos is correctly called but the adapter'snotifyDataSetChanged()
does not cause the views to be regenerated. So basically it does nothing... You can read more about the possible solutions here: https://stackoverflow.com/a/7287121/5272836.The text was updated successfully, but these errors were encountered: