I like the combo a lot and the ability to filter the results.
The only thing is when the combo’s value is set with a valid value and then you open the option list, you can’t see any other values. This makes logical sense, the filtering is removing the entries which do not match, so only 1 value is shown.
This confuses my users as they do not realize it is possible to backspace and remove the value.
Hope this makes sense…
Is there a setting which would show all of the values in this case?
If not, I am thinking of adding an image to the right of the combo which when clicked will clear the selected value. I am wondering if this is a good candidate for a custom item.
dhtmlXForm.prototype.prevComboName = function(){
var last
this.forEachItem(function(name, radioValue){
last = name
})
return last
}
function comboClearIcon(name, value) {
// this is called as the form is being built, so the last item will be the combo
var frm = this.getForm()
var combo = frm.getCombo( frm.prevComboName() )
this.onclick = function( e ) {
combo.unSelectOption()
combo.setComboValue('')
}
return '<a href="javascript:void(0)"><img border="0" style="position:relative;top:-2px;" src="'/whereever/clear_field_24.png"></a>'
}
Here’s the imgae:
This took a few hours to figure out and make generic (and conserve memory). I think the image could be a little nicer. I am going to use this on all of the combos which filter.
Last and final tweek to save a bit of memory because this onclick function is a closure:
dhtmlXForm.prototype.lastFieldName = function(){
var last
this.forEachItem(function(name, radioValue){last=name})
return last
}
dhtmlXCombo.prototype.clearAndFocus=function(){
this.unSelectOption()
this.setComboValue('')
this.DOMelem_input.focus();
}
function comboClearIcon(name, value) {
var frm = this.getForm()
var combo = frm.getCombo( frm.lastFieldName() )
this.onclick = function( e ) { combo.clearAndFocus() }
return '<a href="javascript:void(0)" style="position:relative;top:3px;left:-42px"><img border="0" src="' + app.img16('selection_delete') + '"></a>'
}
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan