title: Could not able to bind Rest JSON data to ListView control in WinJS
body: <p>I am facing a problem. I am trying to bind a ListView WinJS control to a RESTful service that return a JSON object.</p>
  
  <p>Here is my design (default.html)</p>
  
  <pre><code>&lt;body&gt;
      &lt;button id="btnExample"&gt;REST Service&lt;/button&gt;
  
      &lt;div id="divDisplayItems" data-win-control="WinJS.Binding.Template"&gt;
          &lt;div&gt;
  
              &lt;table border="1"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;b&gt;PersonId&lt;/b&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;b&gt;PersonName&lt;/b&gt;&lt;/td&gt;                 
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;h4 data-win-bind="innerText: PersonId"&gt;&lt;/h4&gt;&lt;/td&gt;  
                      &lt;td&gt;&lt;h4 data-win-bind="innerText: PersonName"&gt;&lt;/h4&gt;&lt;/td&gt; 
                  &lt;/tr&gt;
              &lt;/table&gt;            
          &lt;/div&gt;
      &lt;/div&gt; 
      &lt;div 
          id="basicListView" 
          style="width:250px;height:500px"
          data-win-control="WinJS.UI.ListView" 
          data-win-options="{itemDataSource :SourceData.itemList.dataSource, itemTemplate: select('#divDisplayItems'),layout : {type: WinJS.UI.ListLayout}}"
          &gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Here is my default.js code</p>
  
  <pre><code>// For an introduction to the Blank template, see the following documentation:
  // http://go.microsoft.com/fwlink/?LinkId=232509
  (function () {
      "use strict";
  
      var app = WinJS.Application;
      var activation = Windows.ApplicationModel.Activation;
      WinJS.strictProcessing();
  
      app.onactivated = function (args) {
          if (args.detail.kind === activation.ActivationKind.launch) {
              if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
                  // TODO: This application has been newly launched. Initialize
                  // your application here.
              } else {
                  // TODO: This application has been reactivated from suspension.
                  // Restore application state here.
              }
              args.setPromise(WinJS.UI.processAll());            
              document.getElementById("btnExample").addEventListener("click", JSonRecord, false);
          }
      };
  
      app.oncheckpoint = function (args) {
          // TODO: This application is about to be suspended. Save any state
          // that needs to persist across suspensions here. You might use the
          // WinJS.Application.sessionState object, which is automatically
          // saved and restored across suspension. If you need to complete an
          // asynchronous operation before your application is suspended, call
          // args.setPromise().
      };
  
      function JSonRecord(event) {
  
          WinJS
              .xhr(
                      { url: "URL/EmployeeList" }
                   )
              .then
                   (
                      function (response) {
  
                          var sourceData = JSON.parse(response.responseText);
  
                          var datalist = new WinJS.Binding.List(sourceData.EmployeeDetailsResult);
  
                          var dataMembers = { itemList: datalist };
  
                          WinJS.Namespace.define("SourceData", dataMembers);                       
  
                      }, function (error)
                      {
                          console.log(error);
                      }
                   );
      } 
      app.start();
  })();
  </code></pre>
  
  <p>Intension is that whenever the "btnExample" is cliekd, the ListView should be populated. The service is working fine and I am able to get proper data. But the moment I am trying to 
  load the page, it is crashing.</p>
  
  <p>If I comment </p>
  
  <pre><code>"data-win-options="{itemDataSource :SourceData.itemList.dataSource, itemTemplate: select('#divDisplayItems'),layout : {type: WinJS.UI.ListLayout}}"
  </code></pre>
  
  <p>the at least the page is loading.</p>
  
  <p>What is the problem and how can I bind the data to the ListView Control ?</p>
  
  <p>Thanks</p>