jquery-flexdatalist icon indicating copy to clipboard operation
jquery-flexdatalist copied to clipboard

List elements become unremovable once selected with selectionRequired:false

Open stiven-hidri opened this issue 4 years ago • 1 comments

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

stiven-hidri avatar Sep 24 '20 09:09 stiven-hidri

Hi, same here. Did you solve this?

LeonardoFeriato avatar Dec 27 '20 17:12 LeonardoFeriato