Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Create Checkboxes Dynamically #422

Closed
tneil opened this Issue · 8 comments

2 participants

Tim Neil Ryan Renna
Tim Neil
Owner

Ability to create a checkbox dynamically after the DOM for a screen has been loaded.

  • Dynamic way to create/style a checkbox after screen is inserted into the DOM [Completed]
  • Update the existing checkbox sample page to just show the control working [Completed]
  • Add sample page to show how to manipulate control with JavaScript similar to the Dynamic Buttons page [Completed]
  • Remove the script id from the sample pages [Completed]
Tim Neil
Owner

Design Example

Creating the checkbox dynamically should be created to be similar to that of the button control

// Create the element just like you would in a normal screen declaration
var checkbox = document.createElement('input');
checkbox.setAttribute('type','checkbox');
checkbox.setAttribute('value', 'foo');
checkbox.onclick = function() {
        alert(this.value);
    };

// Apply our styling
checkbox= bb.checkbox.style(checkbox);

// Insert it into the screen and update the scroller
document.getElementById('checkboxContainer').appendChild(checkbox);
bb.refresh();
Ryan Renna

The _bb10_dropdown object doesn't seem to contain a style() function for me. I do see a style function for Button and some others

Tim Neil
Owner
Ryan Renna

My mistake, I meant that the checkbox object doesn't seem to contain a style() function

Tim Neil
Owner

That is correct.. this is the requirement/feature request to add this functionality. The code sample is an example of what it should look like when completed.

Ryan Renna

Well then I'm an idiot. Thanks :)

Tim Neil
Owner

LOL!!! I've updated the code example for better clarity :o)

Tim Neil tneil referenced this issue from a commit
Tim Neil updated samples for issue #422 68cf10a
Tim Neil tneil referenced this issue from a commit
Tim Neil sample update for issue #422 154d39f
Tim Neil tneil referenced this issue from a commit
Tim Neil sample updates for issue #422 971e896
Tim Neil
Owner

Checkbox wiki page has now been updated

Tim Neil tneil closed this
Arturo Linares arturolinares referenced this issue from a commit in arturolinares/bbUI.js
Tim Neil updates for dynamic checkbox creation for issue #422 317b70d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.