Results 1 to 2 of 2
  1. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
       #1  
    I can't seem to assign a label to a check box.... the checkbox itself shows up, but not the label I assigned to it and I can't find documentation that instructs on the correct way to assign a label to a check box.
    Here is my main-assistant.jsjsjs
    Code:
    MainAssistant.prototype.setup = function() {
     // Set up Call Log Check Box Widget
     this.checkbox = { property:"value"};
     this.checkboxModel = { value: true, label:"Call Logs..."};
     this.controller.setupWidget('CalllogCB', this.checkbox, this.checkboxModel);
     
     this.controller.listen('CalllogCB', Mojo.Event.propertyChange, this.changed.bind(this));
    The Div line in main-scene.html reads as follows...
    Code:
    <div x-mojo-element="CheckBox" id="CalllogCB" name="CallLog">Call Logs...</div>
    As you can see, I am attempting to assign the label in two different places; however, the checkbox shows up checked... but blank...there is no text next to it saying 'Call Logs...'

    Any help would be appreciated.

    TIA
  2. #2  
    Quote Originally Posted by DrewPre View Post
    I can't seem to assign a label to a check box.... the checkbox itself shows up, but not the label I assigned to it and I can't find documentation that instructs on the correct way to assign a label to a check box.
    [...]
    As you can see, I am attempting to assign the label in two different places; however, the checkbox shows up checked... but blank...there is no text next to it saying 'Call Logs...'

    Any help would be appreciated.

    TIA
    Hi,

    A few things. checkbox attributes probably should be:
    Code:
      this.checkbox = { modelProperty:"value" };
    Though that's optional, and by default is "value" so you could alternatively use:
    Code:
      this.checkbox = {};
    Secondly, there is no label property builtin. Gotta add a label separately.

    Here's how I would do the code:

    main-assistant.jsjsjs
    Code:
    MainAssistant.prototype.setup = function() {
    	// Set up Call Log Check Box Widget
    	this.checkboxModel = {value: true};
    	this.controller.setupWidget('CalllogCB', {}, this.checkboxModel);
    }
    
    MainAssistant.prototype.activate = function(event) {
    	this.changed = this.changed.bindAsEventListener(this);
    	this.controller.listen('CalllogCB', Mojo.Event.propertyChange, this.changed);
    }
    
    MainAssistant.prototype.deactivate = function(event) {
    	this.controller.stopListening('CalllogCB', Mojo.Event.propertyChange, this.changed);
    }
    The Div line in main-scene.html
    Code:
    <div x-mojo-element="CheckBox" id="CalllogCB" name="CallLog"></div><div id="CalllogCBLabel">Call Logs...</div>
    Then you'd also be able to alter the text dynamically with a call like:
    Code:
    this.controller.get("CalllogCBLabel").innerText = 'blah blah';

Posting Permissions