Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#17161 closed defect (duplicate)

RoundRectList: cannot use on() for methods introduced by editableMixinClass

Reported by: Paul Christopher Owned by: Adrian Vasiliu
Priority: undecided Milestone: tbd
Component: DojoX Mobile Version: 1.9.0
Keywords: Cc: bill
Blocked By: Blocking:



See attached test case: It seems that you cannot connect to onXX methods introduced by mixins. E.g. look at dojox/mobile/EdgeToEdgeList which is made editable by setting "editable:true". This causes dojox/mobile to require _EditableListMixin and mix it in using safeMixin (RoundRectList's postCreate method line 94). However connecting to "onDeleteItem" using the syntax

mylist.on('deleteitem', function(){...});

does not work.

The reason is twofold as far as I can see as a newbie:

  • On the one hand, after the safeMixin has happend, "this.constructor._onMap" is not reset in order to make _WidgetBase's _onMap search for new entries.
  • On the other hand, searching by _onMap is not successful, since _onMap only searches in "this.constructor.prototype". But the OnDeleteItem method is part of "this" only and not "this.constructor.prototype".

Attachments (1)

test_on.html (1.9 KB) - added by Paul Christopher 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Paul Christopher

Attachment: test_on.html added

comment:1 Changed 8 years ago by bill

Component: DijitDojoX Mobile
Owner: changed from bill to Eric Durocher
Summary: Cannot use widget.on for methods introduced by mixinsRoundRectList: cannot use on() for methods introduced by editableMixinClass

Thanks for the test case, and summary. I think you are right about what's happening.

So, I think mixins work fine generally, but (as you said) it's just the unusual thing that RoundRectList.postCreate() does where they don't work:

        require([this.editableMixinClass], lang.hitch(this, function(module){
                declare.safeMixin(this, new module());

This is irregular because:

  1. Like you said, it's doing the mixin in postCreate(), thus modifying the instance instead of the prototype.
  2. It's asynchronous.

I can see why dojox/mobile wanted to do it this way, but it's not something dijit ever meant to support, and ISTM the best approach for applications may be to just do:

<ul data-dojo-id="list" data-dojo-type="dojox/mobile/EdgeToEdgeList"

instead of

<ul data-dojo-id="list" data-dojo-type="dojox/mobile/EdgeToEdgeList"

Mobile guys, what do you think? Close this as wontfix and mark the editable and editableMixinClass properties as deprecated?

comment:2 Changed 8 years ago by Paul Christopher

Bill, that's great: Using "on" with data-dojo-mixins works perfectly!

comment:3 Changed 8 years ago by Sebastien Brunot

Note that this ticket is a duplicate of

Last edited 8 years ago by Sebastien Brunot (previous) (diff)

comment:4 Changed 8 years ago by Adrian Vasiliu

Cc: bill added
Owner: changed from Eric Durocher to Adrian Vasiliu
Status: newassigned

comment:5 Changed 8 years ago by Adrian Vasiliu

Resolution: duplicate
Status: assignedclosed
  • For the future (Dojo 2.0...), the intention is indeed, as Bill said, to go for
<ul data-dojo-id="list" data-dojo-type="dojox/mobile/EdgeToEdgeList"
  • Being a duplicate of #16709, I close it as such.
Last edited 8 years ago by Adrian Vasiliu (previous) (diff)
Note: See TracTickets for help on using tickets.