mercredi 22 avril 2015

Ember custom view ecxeption : had no action handler for: searchEvent

I have my custom view :

export default Ember.ContainerView.extend({
  classNames: ['search-terms'],
  eventTypeValue: null,
  userSidValue: null,

  init: function() {
    this._super();

    this.eventTypeValue = Ember.TextField.create();
    this.userSidValue = Ember.TextField.create();

    this.eventTypeValue.set("placeholder", "search by event type");
    this.eventTypeValue.addObserver("value", this.userSidValue, this.change);

    this.userSidValue.set("placeholder", "earch by user sid");
    this.userSidValue.addObserver("value", this.userSidValue, this.change);

    this.pushObject(this.eventTypeValue);
    this.pushObject(this.userSidValue);
  },

  change: function() {
    this.get("controller").send("searchEvent");
  }
});

And controller :

export default Em.Controller.extend({

  actions: {
        searchEvent : function() {
                console.log("controller searchEvent");
        }
  }
  
});

And when I change text in some fields, then I have following exception :

Uncaught Error: had no action handler for: searchEvent

But this working when I type some text and then click somewhere out of my custom view.




Aucun commentaire:

Enregistrer un commentaire