ProgressNS / nativescript-ui-feedback

This repository is used for customer feedback regarding Telerik UI for NativeScript. The issues system here is used by customers who want to submit their feature requests or vote for existing ones.
Other
115 stars 21 forks source link

RadlistView error in loadMoreDataRequested #1025

Open vahidvdn opened 5 years ago

vahidvdn commented 5 years ago

Hi. I confront with an error in loadMoreDataRequested event. I have a very simple RadlistView as following:

<GridLayout style="background-color: #e6e6e6">

    <RadListView #myRadListView loadOnDemandMode="Auto" loadOnDemandBufferSize="8" 
        (loadMoreDataRequested)="onLoadMoreItemsRequested3($event)" [items]="items" 
        pullToRefresh="true" (pullToRefreshInitiated)="onPullToRefreshInitiated($event)" 
        (scrolled)="scrollStartedEvent($event)">

        <ng-template let-item="item" let-i="index">
            <StackLayout>
                <Label [text]="item.post_date" class="discription" [nsRouterLink]="['../item', 5]"></Label>
                <FrescoDrawee verticalAlignment="center"  aspectRatio="1"  [imageUri]="'http://domain.com/'+item.post_picture"></FrescoDrawee>
            </StackLayout>
        </ng-template>
    </RadListView>
</GridLayout>

I have a json and want to render them in list view. Everything works fine when I load whole json in list view. But when I want to use loadMoreDataRequested I get the following errors: (No matter what is the code into this function, I get these errors)

JS: ERROR TypeError: Cannot read property 'post_date' of undefined
JS: ERROR CONTEXT {
JS:   "view": {
JS:     "def": {
JS:       "nodeFlags": 16417,
JS:       "rootNodeFlags": 1,
JS:       "nodeMatchedQueries": 0,
JS:       "flags": 0,
JS:       "nodes": [
JS:         {
JS:           "nodeIndex": 0,
JS:           "parent": null,
JS:           "renderParent": null,
JS:           "bindingIndex": 0,
JS:           "outputIndex": 0,
JS:           "checkIndex": 0,
JS:           "flags": 1,
JS:           "childFlags": 16417,
JS:           "directChildFlags": 1,
JS:           "childMatchedQueries": 0,
JS:           "matchedQueries": {},
JS:           "matchedQueryIds": 0,
JS:           "references": {},
JS:           "ngContentIndex": null,
JS:           "childCount": 4,
JS:           "bindings": [],
JS:           "bindingFlags": 0,
JS:           "outputs": [],
JS:           "element": {
JS:             "ns": "",
JS:             "name": "StackLayout",
JS:             "attrs": [],
JS:             "template": null,
JS:             "componentProvider": null,
JS:             "componentView": null,
JS:             "componentRendererType": null,
JS:             "publicProviders": {},
JS:             "allProviders": "[Circular]"
JS:     ...

Here is my onLoadMoreItemsRequested function: (As I mentioned just a simple log without these operations lead to mentioned errors as well)

onLoadMoreItemsRequested(args) {
  const listView = args.object;
  setTimeout(() => {
    listView.notifyLoadOnDemandFinished();
  }, 3000);
}
vahidvdn commented 5 years ago

This error also occurs when app is initialized or when I start to scroll (without loadMoreDataRequested has been firing) with load on demand mood.

vahidvdn commented 5 years ago

As mentioned by someone in slack channel, I must use async loading as following:

<Label [text]="item?.post_date"></Label>

I don't know why this happens and there is nothing about it in docs.

vahidvdn commented 5 years ago

Actually after adding some other property (ie: width and height of image) and after some loading onLoadMoreItemsRequested function, I get another error and app stops for a few seconds:

ERROR TypeError: Cannot read property 'unit' of null

For now going to reopen this.