Created
February 16, 2016 17:58
-
-
Save Smenus/d7ff6b608a0d262aadad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ComboView extends Marionette.ItemView<ComboField> | |
{ | |
/** | |
* Constructor logic for ComboView. | |
* @param {ComboField} model The model for the ItemView. | |
*/ | |
constructor(model: ComboField) | |
{ | |
this.ui = { | |
control: ".control-field input" | |
}; | |
this.listenTo(model, "change:value", () => this.updateDisplay()); | |
super({model: model}); | |
} | |
/** | |
* Update the display to reflect the backing value. | |
*/ | |
protected updateDisplay(): void | |
{ | |
// Get the kendo object | |
let combobox = (this.ui.control as JQuery).data("kendoComboBox"); // Returns undefined | |
let test = (this.ui.control as JQuery).data("test"); // Also undefined | |
combobox.select(this.model.value.index); | |
} | |
/** | |
* Triggered after the view has been rendered | |
* Should do any post-rendering manipulation of el here | |
*/ | |
public onRender(): void | |
{ | |
// Make the field a kendo component | |
(this.ui.control as JQuery).kendoComboBox(); | |
// Try adding another data value | |
(this.ui.control as JQuery).data("test", "test"); | |
this.updateDisplay(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment