Open punj opened 4 years ago
I can confirm that issue on iOS in our app (NativeScript core, no angular, RadListView 8.1.2). Android is working as expected.
When the request to the webservice starts, the RadListView already calls the onLoadMoreItemsRequested method on iOS. At this moment, there are no dataitems available yet, so
args.returnValue = false;
listView.notifyAppendItemsOnDemandFinished(0, true);
disables the loadOnDemand feature at all.
Even when I try to re-enable it via
setTimeout(function () {
listview.loadOnDemandMode = rlvModule.ListViewLoadOnDemandMode.Auto;
, 3000);
it has no effect. Scrolling down to the end of the list after the 3 seconds does not call the onLoadMoreItemsRequested method anymore. (Ths also does not work on Android, but it is not necessary for us on Android, because the onLoadMoreItemsRequested is not called immediatly there so the loadOnDemand feature keeps enabled until the user scrolls down and there are no more items available).
My purpose is for using RadListView is to loads 20 Records from the webservice call at the loading in the RadListView and upon scroll, it should call the web service again and load 20 more records and so on. But, onLoadMoreItemsRequested is calling before the webservice returned the response and therefore the page is loading blank.
onLoadMoreItemsRequested is CALLED BEFORE WEBSERVICE RETURNED THE RESPONSE. SO RADLISTVIEW IS BLANK.
Platform: I am currently running on iOS
Progress NativeScript UI plugin version: 8.1.2
CLI: 6.5.0
Cross-platform modules: (the version of tns-core-modules in the
package.json
)ngOnInit() { this.layout = new ListViewLinearLayout(); this.layout.scrollDirection = ListViewScrollDirection.Vertical; // this.initDataItems(); this.handleListProducts(); // Calls the webservice this._changeDetectionRef.detectChanges(); this._dataItems = new ObservableArray();
this.addMoreItemsFromSource(6, null);
}
handleListProducts() { this._sourceDataItems = new ObservableArray();
}
public onLoadMoreItemsRequested(args: LoadOnDemandListViewEventData) { console.log("**** onLoadMoreItemsRequested ****"); const that = new WeakRef(this); const listView: RadListView = args.object; if (this._sourceDataItems.length > 0) { setTimeout(function () { that.get().addMoreItemsFromSource(20, listView); }, 0); } else {
args.returnValue = false; listView.notifyAppendItemsOnDemandFinished(0, true); } }