Sebastian,
It involves adding code to several files. I will add this to the next release too:
1. Widget.js:
in AttributeLayerExpressionChange function Line 9:
onAttributeLayerExpressionChange: function (newValue) {
this.expressIndex = newValue;
var valuesObj = lang.clone(this.config.layers[this.AttributeLayerIndex].expressions.expression[newValue].values.value);
html.empty(this.textsearchlabel);
html.place(html.toDom(this.config.layers[this.AttributeLayerIndex].expressions.expression[newValue].textsearchlabel), this.textsearchlabel);
this.paramsDijit.clear();
this.paramsDijit.build(valuesObj, this.resultLayers[this.AttributeLayerIndex], this.config.layers[this.AttributeLayerIndex].url,
this.config.layers[this.AttributeLayerIndex].definitionexpression);
this.paramsDijit.setFocusOnFirstParam();
},
in _initLayerSelect find the comment "//init the first available attrib Layers paramsDijit" (Lines 12 -14):
//init the first available attrib layers paramsDijit
if(attribOptions.length > 0){
var aIndex = attribOptions[0].value;
this.AttributeLayerIndex = aIndex;
this._initSelectedLayerExpressions();
if(this.config.layers[aIndex].expressions.expression.length > 0){
var valuesObj = lang.clone(this.config.layers[aIndex].expressions.expression[0].values.value);
html.empty(this.textsearchlabel);
html.place(html.toDom(this.config.layers[aIndex].expressions.expression[0].textsearchlabel), this.textsearchlabel);
this.paramsDijit.build(valuesObj, this.resultLayers[aIndex], this.config.layers[aIndex].url,
this.config.layers[aIndex].definitionexpression);
on.once(this.paramsDijit, 'param-ready', lang.hitch(this, function () {
this.paramsDijit.setFocusOnFirstParam();
}));
}
in onAttributeLayerChange (Line 10):
onAttributeLayerChange: function (newValue) {
this.AttributeLayerIndex = newValue;
this._initSelectedLayerExpressions();
var valuesObj = lang.clone(this.config.layers[newValue].expressions.expression[0].values.value);
html.empty(this.textsearchlabel);
html.place(html.toDom(this.config.layers[newValue].expressions.expression[0].textsearchlabel), this.textsearchlabel);
this.paramsDijit.clear();
this.paramsDijit.build(valuesObj, this.resultLayers[newValue], this.config.layers[newValue].url,
this.config.layers[newValue].definitionexpression);
this.paramsDijit.setFocusOnFirstParam();
2. Parameters.js
Add this new function:
setFocusOnFirstParam: function(){
var spDoms = query('.widget-esearch-single-parameter',this.tbody);
var sp = registry.byNode(spDoms[0]);
sp.focusValueObj();
},
3. SingleParameter.js
Add new require and parameter (line 4 and 8):
...
'dojo/keys',
'dojo/Evented',
'dijit/focus'
],
function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, template, lang,
html, array, json, on, query, Deferred, FilteringSelect, ValidationTextBox, DateTextBox,
NumberTextBox, Memory, esriRequest,PagingQueryTask,keys,Evented, focusUtil) {/*jshint unused: false*/
Add new function:
focusValueObj:function(){
var shortType = this.value.fieldObj.shortType;
if(shortType === 'string'){
if(this._type === 1){
focusUtil.focus(this.stringTextBox);
}else if(this._type === 2){
focusUtil.focus(this.stringCodedValuesFS);
}
}
else if(shortType === 'number'){
if(this._type === 1){
focusUtil.focus(this.numberTextBox);
} else if(this._type === 2){
focusUtil.focus(this.numberCodedValuesFS);
} else if(this._type === 3){
focusUtil.focus(this.numberTextBox1);
}
}
else if(shortType === 'date'){
if(this._type === 1){
focusUtil.focus(this.dateTextBox);
} else if(this._type === 2){
focusUtil.focus(this.dateTextBox1);
}
}
},