Announcement

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

    Combobox type ahead not working

    Hi Isomorphic ,

    I am creating a simple combobox using the below code.

    Code:
    private ComboBoxItem getCodeDropDown(String fieldName) {
                    final ComboBoxItem comboBox = new ComboBoxItem();
                    final DataSource dataSource = DataSource.get("MyDS");
                    comboBox.setPickListWidth(300);
                    comboBox.setAllowEmptyValue(true);
                    comboBox.setSortField(0);
                    comboBox.setAddUnknownValues(false);
                    comboBox.setAutoFetchData(true);
                    comboBox.setOptionDataSource(dataSource);
                    final Criteria criteria = new Criteria();
                    criteria.addCriteria("someType", 1L);
    
                    comboBox.setOptionCriteria(criteria);
                    final ListGridField nameField= new ListGridField("name", "Name");
                    nameField.setWidth(100);
                    final ListGridField descField = new ListGridField("desc", "Description");
                    descField.setWidth(200);
                    comboBox.setSortField("name");
                    comboBox.setPickListFields(nameField, descField);
                    comboBox.setDisplayField("name");
                    comboBox.setValueField("name");
                    final ListGrid pickListProps = new ListGrid();
                    pickListProps.setSortField("name");
                    pickListProps.setDataFetchMode(FetchMode.BASIC);
                    pickListProps.setCanHover(true);
                    pickListProps.setShowHover(true);
                    pickListProps.setLeaveScrollbarGap(false);
                    comboBox.setPickListProperties(pickListProps);
                    return comboBox;
                }
    Above code works if I open by manualy clicking the combobox. It populates the correct listgrid of options in combobox. When I click directly on combobox and write something the option list opens as empty always. I've set the autofetch true so I can see the fetch call while rendering the grid. So data is available but typeahead is not working.
    Any suggestions?

    #2
    These are all completely ordinary settings that you can see working in many Showcase samples, so the problem is most likely in your fetch call.

    You say you "see the fetch call" which is unclear. You need to look at the data returned from the server in the RPC tab of the Developer Console, and verify the expected fields are there. Also look for any JavaScript errors or warnings.

    Also look at how the comboBox pickList (the drop-down grid) looks. If there rows there but they are blank (eg rollover works), you returned data with the wrong field names. If there's nothing there at all, but the empty message didn't appear, your code crashed.

    Comment


      #3
      Hi Isomorphic , The fetch call is fine, the data returned is correct and data is correctly visible in the drop down grid. Everything seems fine If I open the combobox by clicking and opening pick list. But if I directly click inside combox and type something to filter the listgrid, it's not working.

      Comment


        #4
        When you begin to type, the comboBox issues a fetch with criteria. What happens to that fetch?

        Again please use the diagnostic tools available: the RPC tab shows the fetches and your server’s responses, the main Developer Console tab shows whether a JavaScript error has occurred.

        Comment


          #5
          Isomorphic When I begin to type, combobox is not sending any fetch. I can only see one fetch when the component is rendered because autofetch is true.

          Comment


            #6
            Whether autoFetchData is true or not doesn't matter, unless all of the available options have been fetched, in which case filtering is local. If all available options have been fetched, and you unexpectedly see no results, it may indicate that the data you have returned does not have values for the fields that the criteria are applied to, in which case, of course local filtering will not work.

            Comment

            Working...
            X