I use dijit.form.FilteringSelect
, supported dojox.data.QueryReadStore
, so that the user can select a region (think about automatic completion). On each character entered by the user, QueryReadStore
sends a request to the server, waiting for a list of json matches (with corresponding identifiers). By the time a fairly short list is displayed, the user selects the desired item. [Admittedly, asking for every keystroke is not the most efficient template, but at the moment it’s good enough.]
Unexpected behavior: in some rare but special cases, the choice made by the user "does not stick." For example, if the user enters " can
", she is offered the following options in the following order:
Atlantic Canada
Canada
English Canada
Lower Canada
Upper Canada
Western Canada
If she chooses " Canada
" among them, dijit closes the drop down selection by choosing her choice correctly. But by the time the user leaves the field, the selection will switch to " Atlantic Canada
"!
This strange phenomenon occurs systematically for a small number of specific regions. (First, I thought that the common factor between those who misbehaved was that their name contained accented characters or hyphens, but obviously not with the Canadian example. So far, I do not see a regular pattern.)
. , , dojo, , dojo: ? , ? ? ( Firebug), ? .
dojo 1.1.1, dojo 1.2.3.
() FilteringSelect
:
new dijit.form.FilteringSelect({
name = "region";
autoComplete = false;
hasDownArrow = false;
labelAttr = "name";
queryExpr = "${0}";
store = new dojox.data.QueryReadStore({url:'/query/regions'});
}, myNode);
EDIT (2009/02/18):
, , . , FilteringSelect
onChange
onBlur
, :
(Region 246 is Atlantic Canada
.) ... , (onBlur), Canada
. ...