Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List elements become unremovable once selected with selectionRequired:false #224

Open
stiven-hidri opened this issue Sep 24, 2020 · 1 comment

Comments

@stiven-hidri
Copy link

This is how I set up the list:

const flexdatalistOptions = {
  "visibleProperties": ["name"],
  "textProperty": "{name}",
  "valueProperty": ["_id", "name"],
  "searchIn": "name",
  "searchContain": true,
  "removeOnBackspace": true,
  "selectionRequired": false,
  "noResultsText": 'Nessun risultato trovato per "{keyword}"',
  "multiple": true,
  "minLength": 0,
};
$("#employees_flexdatalist").flexdatalist(Object.assign(flexdatalistOptions, {"data":employees_clients.employees}));

employees_clients.employees is simply an array of objects. Each object has 2 attributes: "_id" and "name", both strings.
I want the user to be able to choose elements that are present in the list but also to insert custom elements. So I set selectionRequired:false.
The problem is that sometimes, after I insert a custom value, I can just add elements because they become unremovable. This force the user to reload the page to get it working again but the problem persists.

When I submit the data the array that the server receives will have both objects or simply strings depending on what the user inserted, which is complitely fine for me.

These are the errors I get:

Uncaught TypeError: t.push is not a function
  at Object.push (jquery.flexdatalist.min.js:2)
  at Object.add (jquery.flexdatalist.min.js:2)
  at Object._extract (jquery.flexdatalist.min.js:2)
  at Object.extract (jquery.flexdatalist.min.js:2)
  at Object.keypressValue (jquery.flexdatalist.min.js:2)
  at HTMLInputElement.<anonymous> (jquery.flexdatalist.min.js:2)
  at HTMLInputElement.dispatch (jquery-3.5.1.min.js:2)
  at HTMLInputElement.v.handle (jquery-3.5.1.min.js:2)
Uncaught TypeError: a.splice is not a function
  at Object.remove (jquery.flexdatalist.min.js:2)
  at Object.remove (jquery.flexdatalist.min.js:2)
  at Object.backSpaceKeyRemove (jquery.flexdatalist.min.js:2)
  at HTMLInputElement.<anonymous> (jquery.flexdatalist.min.js:2)
  at HTMLInputElement.dispatch (jquery-3.5.1.min.js:2)
  at HTMLInputElement.v.handle (jquery-3.5.1.min.js:2)

jequeryflexdatalist v 2.2.4

@LeonardoFeriato
Copy link

Hi, same here. Did you solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants