Hi James,
The parent view needs to know which view to focus and when the parent
view is told to focus then it sends the message to the correct child
view to focus.
maria.ElementView.subclass(checkit, 'TodosAppView', {
constructor: function() {
maria.ElementView.apply(this, arguments);
this._inputView = new checkit.TodosInputView();
this.appendChild(this._inputView);
this.appendChild(new checkit.TodosToolbarView());
this.appendChild(new checkit.TodosListView());
this.appendChild(new checkit.TodosStatsView());
},
properties: {
focus: function() {
this._inputView.focus();
},
//...
maria.ElementView.subclass(checkit, 'TodosInputView', {
properties: {
focus: function() {
this.find('.new-todo').focus();
},
//...
Now the bootstrapping code can do
var view = new checkit.TodosAppView(model);
document.body.appendChild(view.build());
view.focus();
Peter