title: Refresh my list with Handlebars.js
body: <p>I am using iscroll and handlebars.js creating an infinite scroll list.</p>
  
  <p>My template:</p>
  
  <pre><code>    &lt;div id='iscrollwrapper'&gt;
      &lt;div id="scroller"&gt;
          &lt;ul class="media-list"&gt;
              {{#each items}}
              &lt;li class="media well well-sm"&gt;
                &lt;a class="pull-left" href="#"&gt; 
                     &lt;img class="media-object" src='{{escape thumbnailimglink}}' alt="..."&gt;
                &lt;/a&gt;        
                &lt;div class="media-body" onclick="window.location.href='{{escape clickthrulink}}';"&gt;
                      &lt;h4 class="media-heading"&gt;{{description}}&lt;/h4&gt;
                      {{discount}}
                &lt;/div&gt;
              &lt;/li&gt;
              {{/each}}
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In my JS, I am using itemsData to render the list,</p>
  
  <pre><code>    var itemsData = {
      test: 'mytest',
      items:  [
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
         {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
      ]
  };
  
  var itemsData2 = {
          test: 'mytest',
          items:  [
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me2',discount:'50%'},
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me2',discount:'50%'},
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me2',discount:'50%'},
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me2',discount:'50%'},
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me2',discount:'50%'},
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
             {thumbnailimglink:'img/sample.jpg', clickthrulink:'http://www.google.com',description:'this is me',discount:'50%'},
          ]
      };
  Handlebars.registerHelper('escape',function(variable){
      return variable.replace(/(['"])/g, '\\$1'); 
  });
  var homePage = commonModule.render('home', itemsData);
  </code></pre>
  
  <p>inside of my commonModule.render I am using handlebars.js,</p>
  
  <pre><code>var template = Handlebars.compile(this.tmpl_cache[tmpl_name]);
          console.log('tmpl_data:'+tmpl_data);
          var html = template(tmpl_data);
          console.log('htm:'+ html);
          return html;
  </code></pre>
  
  <p>Then the html is added to the container div and it is working good.</p>
  
  <p>Now on the template, I want to have a button, when it is clicked, I will use itemData2 to render the list and refresh the existing container.  Any idea how to do it?</p>
  
  <p>Thanks
  Hammer</p>