materializecss / materialize

Materialize, a web framework based on Material Design

Home Page:https://materializeweb.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]:

redz1029 opened this issue · comments

Before submitting...

Context

Chips Autocomplete Options does not work as expected.

Current Behavior

When typing an item that exists from autocompleteOptions, no suggestion box/dropdown content shows.

Expected behavior

It should show suggestion box.

Possible Solutions or Causes

No response

Steps to reproduce

No response

Your Environment

  • Version used: 1.2.2
  • Browser Name and version: Google Chrome Version 111.0.5563.147 (Official Build) (64-bit)
  • Operating System and version (desktop or mobile): Windows 11
  • Additional information you want to tell us: Please see the attached file to replicate this issue. Thanks
    chip-test.zip

Please provide a sandboxed code example and also use a title for the issue.
Also use more description what you did and what is not working.

I've checked the attached source, and it is actually working.

The only thing you will have to update is the "data" option. The structure you are using is only available since Materialize v2. For the "correct" format in v1.x, you may check the old documentation.

Terefore, in order for the plugin to work, you will have to replace:

$('.chips-autocomplete').chips({
    autocompleteOptions: {
        data: [
            { id: 12, text: "Apple" },
            { id: 13, text: "Microsoft" },
            { id: 42, text: "Google", image: 'http://placehold.it/250x250' }
        ]
    }
});

by:

$('.chips-autocomplete').chips({
    autocompleteOptions: {
        data: {
          "Apple": null,
          "Microsoft": null,
          "Google": 'http://placehold.it/250x250'
        }
    }
});