zkmax.inp.Chosenbox._fireOnSearching perform the following check before sending the onSearching event:
if (value)
This is interpreted as false if value = "", which mean that no onSearching event is sent when removing all characters after a search.
Since ListSubModel rely on onSearching events to update the submodel, this causes listsubmodels not to clean up on empty search bar.
See the attached example (comment the script element for the original behavior)
<zk>
<zscript> ListModel testLML = ListModels.toListSubModel(new ListModelList(Locale.getAvailableLocales()));</zscript>
<script>
zk.afterLoad('zkmax.inp', function() {
var _xChosenbox = {};
zk.override( zkmax.inp.Chosenbox.prototype, _xChosenbox, {
_fireOnSearching: function (value) {
if (value || value=="") {
var c =
;
this.fire("onSearching", c)
}
}
});
});
</script>
<chosenbox width="300px" id="chosenbox" model="${testLML}"/>
</zk>