Cannot get data model when click mouse

edited October 2016 in Enyo 2.7
I have a ListWidget include multi CustomItem,
in ListWidget i raise event onItemListSelected when ontap in CustomItem,

but in Main view i cannot get data model of CustomItem when click mouse on CustomItem, only get data by enter event, please open console debug and help me.

Link jsfiddle:


Thank so much.


  • edited October 2016
    When using custom events, the parameter to pass to doCustomEvent (or doItemListSelected in your example) should be an object and will be the second argument received by any event handlers (e.g. itemSelected). inSender will refer to the component that fired the event (CustomItem) and inEvent.originator, in the case of native events, will refer to the component that fired the originating event (the tap from img).

    A possible solution is to pass the model in a property of the event payload of onItemListSelected:
      model: inSender.model
    which can then be extracted from the event argument in the handler:
    itemSelected:function(inSender, inEvent){
      console.log('content receive ', inEvent.model);
  • Many thanks @theryanjduffy,
    if i want get originator control that is inSender?

  • Seems like you are leaking encapsulation if you need access to the original sender and event. Instead, the event payload should include the data elements needed by its consumers. So, I'd suggest considering what data is needed from the sender or the event and include that as separate elements of the event object passed to doItemListSelected.
Sign In or Register to comment.