Advertisement
joris

Push Data bbUI

Dec 4th, 2012
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.15 KB | None | 0 0
  1. As an example you can get the latest from the samples directory from the bbUI repo and modify the following
  2. index.htm - add the following code to the ondomready function
  3.  
  4. if (params) {
  5.    alert('foo = ' + params.foo);
  6. }
  7.  
  8. js/dataOnTheFly.js - Modify the dataOnTheFly_addListItem() function to look like the code below
  9.  
  10. function dataOnTheFly_addListItem() {
  11.     var listItem, container, dataList = document.getElementById('dataList'),
  12.         data = {'foo': 'bar'};
  13.        
  14.     // Create our list item
  15.     listItem = document.createElement('div');
  16.     listItem.data = data;
  17.     listItem.setAttribute('data-bb-type', 'item');
  18.     listItem.setAttribute('data-bb-img', 'images/icons/icon11.png');
  19.     listItem.setAttribute('data-bb-title', 'Title ');
  20.     listItem.innerHTML = 'My description';
  21.     listItem.onclick = function() {
  22.         bb.pushScreen('grid.htm', 'grid', listItem.data);
  23.     }
  24.     // Append the item
  25.     dataList.appendItem(listItem);
  26. }
  27.  
  28.  
  29. Now when you open this page (shown on the main menu as "Load Data After Showing") in the sample app and click on one of the generated list items it will open the grid list screen and the ondomready function will do an alert with the text "foo = bar"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement