Opened 9 years ago
Last modified 9 years ago
#17451 new defect
ComboBoxMixin and _FormSelectWidget patch their store and break each other.
Reported by: | qMax | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 2.0 |
Component: | Dijit - Form | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
When new style store is passed as parameter to ComboBoxMixin?, it modifies its store and adds methods getValue, getLabel, fetch to produce deprication warnings (in postMixInProperties()).
Now if the same store is used in other Select-based widgets, the _FormSelectWidget threats it like old-api and tries to use nonexistant methods. (in setStore()) Also, it patches the store again to make it look like new-style api. (also in setStore())
Why on earth should widget patch data store api?
P.S. workaround is to use set('store') everywhere.
Attachments (1)
Change History (4)
comment:1 Changed 9 years ago by
Owner: | set to qMax |
---|---|
Status: | new → pending |
Changed 9 years ago by
Uncaught TypeError?: Object [object Object] /* the store */ has no method 'getLabelAttributes' dijit/form/_FormSelectWidget.js:332
comment:2 Changed 9 years ago by
When Combo is created this way:
var myCombo = declare([ComboBox], { store: store, searchAttr: 'label' });
The store is not in params and became patched.
In attached file an error only occurs if Combo is created before Select. No error when in opposite order.
comment:3 Changed 9 years ago by
Milestone: | tbd → 2.0 |
---|---|
Owner: | qMax deleted |
Status: | pending → new |
Ah yes that case doesn't work correctly. The patching code should probably be more particular, and only patch the dijit/form/DataList store. But anyway this problem will fix itself in V2 when all the back-compat code goes away.
I don't think so. The code that adds those methods in postMixInProperties() only runs when ComboBox? creates a store internally. Notice the first clause of the if() statement:
As the comment in the code says:
Anyway, there may be some issue, but please attach a full (but minimal) test case (using the attach file button) that demonstrates the issue.