blackberry / jQueryMobile-BB10-Theme

jQuery Mobile BlackBerry 10 Theme
Apache License 2.0
72 stars 56 forks source link

Creating Drop Down Box Dynamically In JavaScript? #50

Closed jpeszleny closed 11 years ago

jpeszleny commented 11 years ago

I am trying to create a drop dynamically when a page loads. I want to drop box to have a BB10 look to it but I can't get it to work. I am looping getting data from a web sql database and creating the drop down options. I then dump it into a div. This code works and creates a drop down but not with the BB10 theme. Any help would be greatly appreciated! Thanks!

function onGetAllCoursesSuccess(results) { var tasksHtml = ''; var courseID = ''; var aRow = null;

tasksHtml += 'select name="select-choice-1" id="courseName"';

for (var x = 0; x < results.rows.length; x++) {

   aRow = results.rows.item(x);
   courseID = aRow['id'];
   tasksHtml += '<option value="' + aRow['course'] + '" data-placeholder="true">' + aRow['course'] + '</option>';

}

tasksHtml += "/select";

$("#allCoursesDiv").empty(); $("#allCoursesDiv").html(tasksHtml);

Gerii commented 11 years ago

You have to call $("#allCoursesDiv").trigger("create"); to apply the style. 

jpeszleny commented 11 years ago

Work's great. Thanks!