Advertisement
joris

BBUI Sample

Sep 4th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function dataOnTheFly_initialLoad(element) {
  2.     // I'm just doing a setTimeout to mimic processing some data
  3.     // in a background worker thread
  4.     setTimeout(dataOnTheFly_loadAfterTimeout,1000);
  5. }
  6.  
  7. function dataOnTheFly_loadAfterTimeout() {
  8.     document.getElementById('waiting').style.display = 'none';
  9.     dataOnTheFly_addListItem()
  10.     dataOnTheFly_addListItem()
  11.     dataOnTheFly_addListItem()
  12. }
  13.  
  14. function dataOnTheFly_addListItem() {
  15.     var listItem, container, dataList = document.getElementById('dataList');
  16.     // Create our list item
  17.     listItem = document.createElement('div');
  18.     listItem.setAttribute('data-bb-type', 'item');
  19.     listItem.setAttribute('data-bb-img', 'images/icons/icon11.png');
  20.     listItem.setAttribute('data-bb-title', 'Title ');
  21.     listItem.innerHTML = 'My description';
  22.     // Create a dummy container
  23.     container = document.createElement('div');
  24.     container.appendChild(listItem);
  25.     // Apply the styling
  26.     bb.imageList.apply([container]);
  27.     // Append the item
  28.     dataList.appendChild(container.firstChild);
  29.     // re-compute the scrolling area
  30.     if (bb.scroller) {
  31.         bb.scroller.refresh();
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement