Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3082

Chosenbox onSearching does not fire with an empty value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.0.2
    • 7.0.7, 8.0.1
    • None
    • Security Level: Jimmy
    • ZK 8.0.2 S1

      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 =

      { text: value }

      ;
      this.fire("onSearching", c)
      }
      }
      });
      });
      </script>
      <chosenbox width="300px" id="chosenbox" model="${testLML}"/>
      </zk>

            DevChu DevChu
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h