Fix: ListView not showing first items of VirtArray

This commit is contained in:
vakrilov
2017-02-09 16:52:14 +02:00
parent 4ce4b12859
commit 87f936bcd8
5 changed files with 54 additions and 54 deletions

View File

@@ -1,10 +1,10 @@
import {ImageSource, fromFile as imageSourceFromFile} from "image-source";
import {VirtualArray, ItemsLoading as virtualArrayItemsLoadingData} from "data/virtual-array";
import {Observable} from "data/observable";
import {Cache as ImageCache} from "ui/image-cache";
import { ImageSource, fromFile as imageSourceFromFile } from "image-source";
import { VirtualArray, ItemsLoading as virtualArrayItemsLoadingData } from "data/virtual-array";
import { Observable } from "data/observable";
import { Cache as ImageCache } from "ui/image-cache";
import {Data as RedditData} from "./reddit-model";
import {RedditViewModel} from "./reddit-item-view-model";
import { Data as RedditData } from "./reddit-model";
import { RedditViewModel } from "./reddit-item-view-model";
var aboutText = "Cuteness is a proof of concept app demonstrating the Telerik's NativeScript for writing native mobile applications using JavaScript.";
export var defaultThumbnailImageSource = imageSourceFromFile("~/cuteness.io/res/reddit-logo.png");
@@ -28,9 +28,9 @@ export class AppViewModel extends Observable {
this._redditItems.loadSize = 50;
this._redditItems.on(VirtualArray.itemsLoadingEvent, (args: virtualArrayItemsLoadingData) => {
fetch(redditUrl + args.count + (after ? "&after=" + after : "")).then<RedditData>(response=> response.json()).then(result => {
fetch(redditUrl + args.count + (after ? "&after=" + after : "")).then<RedditData>(response => response.json()).then(result => {
var itemsToLoad = result.data.children.map(i=> {
var itemsToLoad = result.data.children.map(i => {
return new RedditViewModel(i.data);
});

View File

@@ -1,8 +1,8 @@
import {Observable} from "data/observable";
import {ImageSource, fromFile as imageSourceFromFile, fromUrl as imageSourceFromUrl} from "image-source";
import { Observable } from "data/observable";
import { ImageSource, fromFile as imageSourceFromFile, fromUrl as imageSourceFromUrl } from "image-source";
import {ItemData} from "./reddit-model";
import {defaultThumbnailImageSource, defaultNoThumbnailImageSource, cache} from "./reddit-app-view-model";
import { ItemData } from "./reddit-model";
import { defaultThumbnailImageSource, defaultNoThumbnailImageSource, cache } from "./reddit-app-view-model";
var firstThumbnailImageSource = imageSourceFromFile("~/cuteness.io/res/first-image.png");
var defaultImageSource = imageSourceFromFile("~/cuteness.io/res/reddit-logo-transparent.png");