Opened 9 years ago

Closed 8 years ago

Last modified 6 years ago

#12373 closed enhancement (fixed)

ComboBox: support dojo.store

Reported by: bill Owned by:
Priority: high Milestone: 1.7
Component: Dijit - Form Version: 1.6.0rc1
Keywords: Cc:
Blocked By: Blocking:

Description

Enhance ComboBox to support connecting to a dojo.store by default. If ComboBox is created with a store parameter that's a dojo.data Object, then require() dojo.store.DataStore and use it to wrap the dojo.data store Object, converting it into a dojo.store.

Change History (18)

comment:1 Changed 8 years ago by bill

Resolution: fixed
Status: newclosed

(In [24654]) Enhance dijit's ComboBox and FilteringSelect to be able to source from the new dojo.store API. The old dojo.data API will be supported until 2.0.

Change dojox.mobile.ComboBox widget to source from the new dojo.store API rather than the old dojo.data API.

Add cancel() ability to dojo.store.DataStore?, to be able to cancel a fetch running on the underlying dojo.data store.

Fixes #12373 !strict

comment:2 Changed 8 years ago by bill

Component: DijitDijit - Form

comment:3 Changed 8 years ago by bill

(In [25502]) Support ComboBox.store.fetch() for back compatibility. Only pulls in ObjectStore code if/when fetch() is called. Refs #12373 !strict.

comment:4 in reply to:  1 Changed 8 years ago by ben hockey

Replying to bill:

(In [24654]) Enhance dijit's ComboBox and FilteringSelect to be able to source from the new dojo.store API.

<snip>

http://bugs.dojotoolkit.org/browser/dijit/trunk/form/FilteringSelect.js?rev=24654#L210 and http://bugs.dojotoolkit.org/browser/dijit/trunk/form/_AutoCompleterMixin.js?rev=24654#L556 both use this type of code

dojo.when(promise, function (result, error) {
    if (error) {
        // handle error
    }
    else {
        // handle result
    }
});

afaik, unless something is happening that is not "normal" for promises, this won't work in the error case. it should be

dojo.when(promise, function (result) {
    // handle result
}, function (error) {
    // handle error
});

comment:5 Changed 8 years ago by bill

(In [25529]) fix dojo.when() calls, thanks neonstalwart, refs #12373 !strict

comment:6 Changed 8 years ago by bill

(In [25531]) Better backwards compatibility: make ComboBox.store point to the original store passed in as an initialization parameter (even when the store implements the old dojo.data API), and make the selected item (ComboBox.item) a native item from that store. If ComboBox.store is the old dojo.data API, adds methods to make it act more like the new API.

Refs #12373 !strict

comment:7 Changed 8 years ago by bill

(In [25719]) fix typo, refs #12373 !strict

comment:8 Changed 8 years ago by ben hockey

what is the plan for dijit.form.Select or more specifically dijit.form._FormSelectWidget? currently only dojo.data is supported.

comment:9 Changed 8 years ago by bill

I'd like to get all the widgets supporting the new store API soon. Certainly by 2.0 (when we'll drop support for the old dojo.data API), but ideally for 1.8. No guarantees though.

comment:10 Changed 8 years ago by jameyg

Related to store conversion: should FilteringSelect? be a store Observer so that store changes that affect the query result set could be reflected in the FilteringSelect?'s validity (i.e. removing the FS's value item from the store should cause the FS to become invalid). Similar but unrelated to conversion, should FilteringSelect?.set('query') immediately result in a store.query() [again, to trigger a validation check]?

comment:11 Changed 8 years ago by bill

should FilteringSelect be a store Observer so that store changes that affect the query result set could be reflected in the FilteringSelect's validity

We could do that, although it comes at the cost of more code, and no one has requested it until now so it doesn't seem like anyone needs that.

Similar but unrelated to conversion, should FilteringSelect.set('query') immediately result in a store.query() [again, to trigger a validation check]?

Yes, technically that should happen, resetting the query could affect the validity or change the selected item. Again though it's an edge case that requires more code and not sure if it's worth it.

Anyway, neither of these issues has anything to do with this ticket.

comment:12 Changed 8 years ago by bill

(In [25771]) Switch ComboBox? back so it passes in a string rather than a regex when talking to a store with the old dojo.data API. Seems better for backwards compatibility.

Refs #12373, #13416, #13880 !strict.

comment:13 Changed 8 years ago by bill

(In [25934]) Allow dynamic update of ComboBox.store, refs #12373, fixes #13511 !strict

comment:14 Changed 8 years ago by bill

In [26896]:

For better back-compat, when connecting to legacy store, make sure searchAttr is an actual String rather than a Regex with a toString() method. This was done for ComboBox in [25771] but I missed the other case of FilteringSelect's reverse lookup.

Also avoid (unnecessarily) adding a toString() method to a String.

The code duplication is unfortunate but it will go away in 2.0.

Fixes #14099, refs #12373 !strict.

comment:15 Changed 6 years ago by Bill Keese <bill@…>

In 2253d0eb61e178fce92d4b9bb68aaad7ad3cade3/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:15 Changed 6 years ago by Bill Keese <bill@…>

In 7bd8e58c4ceb56b4d2e1a110c32a3930991d8d54/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:16 Changed 6 years ago by Bill Keese <bill@…>

In 7799376092e6eb92266aece9dab8ce5b97d1a60a/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:17 Changed 6 years ago by Bill Keese <bill@…>

In b0e266d09fc83ae16bdc25a978cf945d2433299a/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 
Note: See TracTickets for help on using tickets.