none
Not all items of a binding List displayed in a Split App with Studio 2013 RRS feed

  • Allgemeine Diskussion

  • I have a a Metro Split App which works perfectly with Visual Studio 2012 in Windows 8.

    Now I tried to convert to Visual Studio 2013 and Windows 8.1. Compiled fine but when I run the App I found that not all items are displayed in the list on the left side of the split App.
    Only about 500 items are displayed from my total of around 1700 items.

    So I tried a new sample Split App in Visual Studio 2013 from scratch and just adapted generateSampleData() to load 1000 items instead of the handfull in the sample. And there again - only the first 500 (sometimes a bit more or less) items are displayed in the list. You see in the scroll bar that there are more items but they are not displayed.

    I append here only the data.js of the split app.

    Many thanks for any help. Martin Klein (martin.klein.austria@gmail.com)

    (function () {
        "use strict";
    
        var dataFile = null;
        var list = new WinJS.Binding.List();
    
        var itemContent = "";
        var itemDescription = "";
        var groupDescription = "";
    
        var darkGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY3B0cPoPAANMAcOba1BlAAAAAElFTkSuQmCC";
        var lightGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY7h4+cp/AAhpA3h+ANDKAAAAAElFTkSuQmCC";
        var mediumGray = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXY5g8dcZ/AAY/AsAlWFQ+AAAAAElFTkSuQmCC";
        var oper = "Video Covers/L elisir d amore.jpg";
        var drama = "Video Covers/Die Nebel von Avalon.jpg";
        var action = "Video Covers/batman.jpg";
        var comedy = "Video Covers/Asterix bei den Olympischen Spielen.jpg";
        var theater = "Video Covers/Der Zerrissene.jpg";
        var favourites = "Video Covers/Manche moegen's heiss.jpg";
    
        var sampleGroups = [
            { key: "1. Alle Filme", title: "Alle Filme", subtitle: "", backgroundImage: mediumGray, description: groupDescription },
            { key: "2. Opern", title: "Opern", subtitle: "", backgroundImage: oper, description: groupDescription },
            { key: "3. Action Filme", title: "Action Filme", subtitle: "", backgroundImage: action, description: groupDescription },
            { key: "4. Komödien", title: "Komödien", subtitle: "", backgroundImage: comedy, description: groupDescription },
            { key: "5. Theater", title: "Theater", subtitle: "", backgroundImage: theater, description: groupDescription },
            { key: "6. Drama", title: "Drama", subtitle: "", backgroundImage: drama, description: groupDescription },
            { key: "7. Favourites", title: "Favourites", subtitle: "", backgroundImage: favourites, description: groupDescription },
            { key: "group6", title: "Group Title: 6", subtitle: "Group Subtitle: 6", backgroundImage: darkGray, description: groupDescription }
        ];
    
        generateSampleData().forEach(function (item) {
            list.push(item);
        });
    
     
        var groupedItems = list.createGrouped(
            function groupKeySelector(item) { return item.group.key; },
            function groupDataSelector(item) { return item.group; }
        );
    
        WinJS.Namespace.define("Data", {
            items: groupedItems,
            list: list,
            sampleGroups: sampleGroups, 
            groups: groupedItems.groups,
            getItemReference: getItemReference,
            getItemsFromGroup: getItemsFromGroup,
            resolveGroupReference: resolveGroupReference,
            resolveItemReference: resolveItemReference,
        });
    
    
    
        // Einen Verweis für ein Element abrufen, dabei den Gruppenschlüssel und Elementtitel als
        // eindeutigen Verweis auf das Element verwenden, der einfach serialisiert werden kann.
        function getItemReference(item) {
            return [item.group.key, item.title];
        }
    
        // Diese Funktion gibt eine WinJS.Binding.List zurück, die nur die Elemente enthält,
        // die zur bereitgestellten Gruppe gehören.
        function getItemsFromGroup(group) {
            return list.createFiltered(function (item) { return item.group.key === group.key; });
        }
    
        // Die eindeutige Gruppe abrufen, die dem bereitgestellten Gruppenschlüssel entspricht.
        function resolveGroupReference(key) {
            return groupedItems.groups.getItemFromKey(key).data;
        }
    
        // Ein eindeutiges Element vom bereitgestellten Zeichenfolgenarray abrufen, in dem ein
        // Gruppenschlüssel und ein Elementtitel enthalten sein sollten.
        function resolveItemReference(reference) {
            for (var i = 0; i < groupedItems.length; i++) {
                var item = groupedItems.getAt(i);
                if (item.group.key === reference[0] && item.title === reference[1]) {
                    return item;
                }
            }
        }
    
        // Gibt ein Array mit Beispieldaten zurück, die zur Datenliste der Anwendung hinzugefügt
        // werden können. 
        function generateSampleData() {
    
            var index = 0;
            var sampleItems = [];
            var dataPromises = [];
    
            for (var i = 0; i <= 1000; i++) {
                var film = {
                    group: sampleGroups[0],
                    index: "Test",
                    title: i,
                    subtitle: "Test",
                    description: "Test",
                    content: "Test",
                    backgroundImage: darkGray,
                    filmpfad: "Test",
                    filmfilename: "Test"
                };
                sampleItems[index] = film;
                index++;
    
            }
            return sampleItems;
        }
    
    })();
    Montag, 11. November 2013 14:58

Alle Antworten