Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Enabling setCompleteOnTab in a ComboBoxItem when only one option is left in the filtered out dropdown list.

    In our application we are using ComboxItem for dropdown in a listgrid. In the comboboxItem CompleteOnEnter property has been set to true and setCompleteOnTab to false.
    comboBoxItem.setCompleteOnTab(false);
    comboBoxItem.setCompleteOnEnter(true);

    Now when user is typing something in the ComboBox and only one option is left in the filtered out dropdown, in that scenario we want that the only dropdown option that is left should get selected on tab key.
    How can we implement that.

    #2
    Before starting on this, consider that in an accessibility review, this might be considered a violation, because a non-sighted user would not immediately know that there was only one option the way a sighted user would.

    If you still want to go ahead with this, you would add keyboard event handling that looks at the pickList to see that only on option remains, and then calls setValue().

    Comment


      #3
      How to get the picklist for a ComboBoxItem in runtime so that I can check the length. I tried with filterClientPickListData(), getClientPickListData() in both the cases it is returning null. We are using SmartGWT version 12.1-p20210819.

      Comment


        #4
        There is literally a getPickList() API. The pickList is a subclass of ListGrid, so APIs list getTotalRows() are available.

        Comment


          #5
          I saw getPickList() is available from smartgwt version 13. We are using 12.1-p20210819, it seems that getPickList is not available in this version. Could you please confirm. In that case is there any other method that we can use to get the picklist.

          Comment


            #6
            In older versions, getCanvasAutoChild("pickList") is equivalent.

            Comment


              #7

              I am again getting null while using getCanvasAutoChild("pickList") .

              Code snippet:
              comboBoxItem.addKeyUpHandler(handler -> {
              Canvas pl = item.getCanvasAutoChild("pickList");
              GWT.log("In face type keyup handler" + handler.getKeyName());

              });

              Comment


                #8
                We did some testing and we couldn't reproduce the issue.

                Take into account that you need to open or start typing into the ComboBoxItem in order to get the pickList via getCanvasAutoChild(). Otherwise, the pickList will be null.

                Regards
                Isomorphic Software

                Comment

                Working...
                X