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

listbox does not change selected element if it is changed in the onselect event.

XMLWordPrintable

      If you have a listbox like:

      <listbox id="articleListbox" checkmark="true" mold="paging" pageSize="20"
      model="@load(vm.articleList)" selectedItem="@bind(vm.selectedArticle)"
      onSelect="vm.onSelectArticleListbox()">

      and in the viewmodel you've got a method

      @NotifyChange("*")
      public void onSelectArticleListbox() {
      try

      { checkValidation(rootWindow); } catch (WrongValuesException e){ selectedArticle = prevSelectedArticle; throw e; } finally { prevSelectedArticle = selectedArticle; }
      }

      zk will not notice that the selectedItem of the listbox just changed again.
      if you change the method to directly reload the component it works:

      public void onSelectArticleListbox() {
      try{ checkValidation(rootWindow); }

      catch (WrongValuesException e)

      { selectedArticle = prevSelectedArticle; getDataBinder().loadComponent(articleListbox, false); throw e; }

      finally

      { prevSelectedArticle = selectedArticle; }

      }

            Unassigned Unassigned
            yennor yennor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: