Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bb.cascades 1.0
- Page {
- titleBar: TitleBar {
- title: root.activeTab.title
- }
- Container {
- DropDown {
- id: first
- title : "First"
- onCreationCompleted: {
- populateDropDown(first, template);
- print('DropDown', title, count(), template.count());
- }
- }
- DropDown {
- id: second
- title : "Second"
- onCreationCompleted: {
- populateDropDown(second, template);
- print('DropDown', title, count());
- }
- }
- }
- attachedObjects: [
- DropDown {
- id: template
- title : "Template"
- Option {
- text : "One"
- value : 1
- }
- Option {
- text : "Two"
- value : 2
- selected : true
- }
- Option {
- text : "Three"
- value : 3
- }
- onCreationCompleted: {
- print('DropDown', title, count());
- }
- },
- ComponentDefinition {
- id: optionTemplate
- Option {
- }
- }
- ]
- function populateDropDown(dropdown, template) {
- for (var i = 0; i < template.count(); i++) {
- var source = template.at(i);
- var option = optionTemplate.createObject();
- option.text = source.text;
- option.value = source.value;
- option.selected = source.selected;
- // etc, as required
- dropdown.add(option);
- }
- }
- onCreationCompleted: {
- print('Page', template.count());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment