Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Create Checkboxes Dynamically #422

Closed
tneil opened this Issue · 8 comments

2 participants

@tneil
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]
@tneil
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();
@rrenna

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

@tneil
Owner
@rrenna

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

@tneil
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.

@rrenna

Well then I'm an idiot. Thanks :)

@tneil
Owner

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

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

Checkbox wiki page has now been updated

@tneil tneil closed this
@arturolinares 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.