Which template (blank app or grid app) should I use if I want to use template function to create listview?


  • Which template (blank app or grid app) should I use if I want to use template function to create listview? When I use grid app template it already creates 3 pages with a listview (And generates lots of code). So it gets confusing where to add my JS template function. Does this mean I need to use blank app template? Will it create only first (groupedItems) page?
    Wednesday, May 8, 2013 6:19 AM


All replies

  • Hi,

    Depends on how well you understand the basics and controls. The Grid app is good for beginers , because it gives default templates and code and you just need to modify/add your code.

    Blank app is good if you know how things are wired up and/or controls work.

    - Girija

    Wednesday, May 8, 2013 9:42 PM
  • Then using the blank app template and copying the Navigation code,including navigation.js, from Grid app (If you need navigation inside your app) will be better.


    Wednesday, May 8, 2013 11:32 PM
  • Yes , that should be better. You can do that. Also you can use a separate project (grid one ) for any reference (in case you require).

    - Girija

    Thursday, May 9, 2013 12:14 AM
  • Thanks Girija and Karthika.

    I like the grid app template because it gives so much. But I want to add interactivity (like adding click event) on some items. I have tried many options to add click events, but none of them are working. In listview template function documentation it says, "It is recommended to use template binding FUNCTION to add interactive items in a listview". I understand this means do not use declarative (HTML mark-up to create listview control.).

    My problem is how do I use template function in grid app template? Where do I add it? Please share details, if possible collecting some code example.

    Thursday, May 9, 2013 5:39 AM
  • How to check if navigation is not working?
     I created a blank template app, and added other pages and controls to make it a listview app. The problem is that when I run the project, I see only blank default.html. It does not load first page (home ) inside it. I've copied navigator.js from other grid template project. I've tried to follow each instruction to use a listview templating function. Any idea?


    • Edited by SonalMac Friday, May 10, 2013 7:52 PM
    Friday, May 10, 2013 7:49 PM
  • You can use blank app template and write all the code required to generate a listview. Or you can use grid app and just replace the with you add r code for data object

    in the data.js. If you want add your own JS template you can do so by adding the

     var itemTemplate = WinJS.Utilities.markSupportedForProcessing(function MyCellSpanningJSTemplate(itemPromise) {
            return itemPromise.then(function (currentItem) {
                var result = document.createElement("div");

    above code into your data object and bind it to your listview.http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/24c843ba-1063-42ce-bfc2-d0f7127fe6f9
    Sunday, May 12, 2013 3:56 PM