cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!-- Simple template for the ListView instantiation  -->
<div class="smallListIconTextTemplate" 
     data-win-control="WinJS.Binding.Template" 
     style="display: none">
    <div class="smallListIconTextItem">
        <span class="date-picker">
          <img src="#" 
             class="smallListIconTextItem-Image date-picker" 
             data-win-bind="src: picture"
             onerror="this.style.display='none'"/>
        </span>
        <div class="smallListIconTextItem-Detail">
            <h4 class="win-h4" data-win-bind="textContent: title"></h4>
            <h6 class="win-h6" data-win-bind="textContent: text"></h6>
        </div>
    </div>
</div>

<div class="listLayoutTopHeaderTemplate" data-win-control="WinJS.Binding.Template">
    <div class="listLayoutTopHeaderTemplateRoot">
        <div data-win-bind="innerHTML: title"></div>
    </div>
</div>

<!-- Elements used for header and footer elements for ListView -->
<div class="headerFooterPlaceholder">
    <div class="header">
        <h2 class="win-h2" style="text-overflow: ellipsis;">Ordered ListView with Simulated Loading</h2>
        <p>
            <span>Total Items: </span>
            <span data-win-bind="textContent: data.length"></span>
        </p>
    </div>
    <div class="footer">
        <div class="status">
            <div>Loading more items </div>
            <progress class="win-progress-bar progress hide"></progress>
        </div>
    </div>
</div>

<div id="listView"
     class="listView win-selectionstylefilled"
     data-win-control="WinJS.UI.ListView"
     data-win-options="{
            itemDataSource: Sample.ListView.data.dataSource,
            itemTemplate: select('.smallListIconTextTemplate'),
            header: select('.header'),
            footer: select('.footer'),
            onheadervisibilitychanged: Sample.ListView.eh.headerVisibility,
            onfootervisibilitychanged: Sample.ListView.eh.footerVisibility,
            layout: { type: WinJS.UI.ListLayout, groupHeaderPosition: 'top'},
            groupDataSource: Sample.ListView.data.groups.dataSource,
            groupHeaderTemplate: select('.listLayoutTopHeaderTemplate'),                        
            selectionMode: 'none',
            tapBehavior: 'none'
        }">
</div>

            
          
!
            
              /* Template for the items in the ListViews in this sample */       
.smallListIconTextItem
{
    width: 100%;
    height: 70px;
    padding: 5px;
    overflow: hidden;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}

    .smallListIconTextItem img.smallListIconTextItem-Image 
    {
        width: 64px;
        height: 64px;
        margin: 5px;
        margin-right:20px;
    }

    .smallListIconTextItem .smallListIconTextItem-Detail
    {
        margin: 5px;
    }

   .listLayoutTopHeaderTemplateRoot, .gridLayoutLeftHeaderTemplateRoot {
        font-size: larger;
        margin-left: 16px;
    }
    
/* CSS applied to the ListViews in this sample */
#listView
{
    height: 100%;
}

.headerFooterPlaceholder {
    display: none;
}

.listView .header,
.listView .footer {
    height: 80px;
    padding: 10px;
    background-color: #333;
}

.listView .footer .progress.hide {
    display: none;
}

img.date-picker {
  display: none;
}

span.date-picker:after {
  font-family: FontAwesome;
  content: "\f03e";
  color: grey;
  font-size: 64px;
  display: inline-block;
  margin-top: 0em;
  margin-bottom: 0em;
  margin-right: 5px;
}
            
          
!
            
              function generateItems(numberOfTimes) {
    var itemArray = [
        { title: "Marvelous Mint", text: "Gelato", picture: "/images/fruits/60Mint.png" },
        { title: "Succulent Strawberry", text: "Sorbet", picture: "/images/fruits/60Strawberry.png" },
        { title: "Banana Blast", text: "Low-fat frozen yogurt", picture: "/images/fruits/60Banana.png" },
        { title: "Lavish Lemon Ice", text: "Sorbet", picture: "/images/fruits/60Lemon.png" },
        { title: "Creamy Orange", text: "Sorbet", picture: "/images/fruits/60Orange.png" },
        { title: "Very Vanilla", text: "Ice Cream", picture: "/images/fruits/60Vanilla.png" },
        { title: "Banana Blast", text: "Low-fat frozen yogurt", picture: "/images/fruits/60Banana.png" },
        { title: "Lavish Lemon Ice", text: "Sorbet", picture: "/images/fruits/60Lemon.png" }
    ];

    // Generate items by looping through itemArray by the numberOfTimes given
    var items = [];
    for (var i = 0; i < numberOfTimes; i++) {
        itemArray.forEach(function (item) {
            items.push(item);
        });
    }

    return items;
};

// Generate 16 items
var items = generateItems(2);
var data = new WinJS.Binding.List(items);

var groupedData = data.createGrouped(function (item) {
    return item.title.toUpperCase().charAt(0);
}, function (item) {
    return {
        title: item.title.toUpperCase().charAt(0)
    };
}, function (left, right) {
    return left.charCodeAt(0) - right.charCodeAt(0);
});

WinJS.Namespace.define("Sample.ListView", {
    generate: generateItems,
    data: groupedData,
    eh: {
        footerVisibility: WinJS.UI.eventHandler(function (ev) {
            var visible = ev.detail.visible;
            if (visible) {
                WinJS.Utilities.removeClass(Sample.ListView.progress, "hide");
                WinJS.UI.Animation.fadeIn(Sample.ListView.status);

                // Simulate XHR by just setting a timeout and updating the observable binding list
                WinJS.Promise.timeout(100).then(function () {
                    var items = Sample.ListView.generate(2);
                    items.forEach(function (item) {
                        Sample.ListView.data.push(item);
                    });
                });
            } else {
                WinJS.Utilities.addClass(Sample.ListView.progress, "hide");
            }
        })
    }
});

// Cache ListView and Header elements
Sample.ListView.listView = document.querySelector(".listView");
Sample.ListView.header = document.querySelector(".header");
Sample.ListView.progress = document.querySelector(".footer .progress");
Sample.ListView.status = document.querySelector(".footer .status");

// Data bind header element and split pane element
WinJS.Binding.processAll(Sample.ListView.header, Sample.ListView).then(function () {
    return WinJS.Binding.processAll(Sample.ListView.splitPane, Sample.ListView);
}).then(function () {
    // Process UI to initialize WinJS controls 
    return WinJS.UI.processAll();
});

var msToTime = function(duration) {
  var milliseconds = parseInt((duration % 1000)/100);
  var seconds = parseInt((duration / 1000) % 60);
  var minutes = parseInt((duration / (1000*60)) % 60);
  var hours = parseInt((duration / (1000*60*60)) % 24);

  hours = (hours < 10) ? "0" + hours : hours;
  minutes = (minutes < 10) ? "0" + minutes : minutes;
  seconds = (seconds < 10) ? "0" + seconds : seconds;

  return hours + ":" + minutes + ":" + seconds + "." + milliseconds;
};

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console