Deletion works if done item by item.
What sometimes does not work is the change of the dropdown list to empty.
Albeit, always sending { payload: "" }
For example:
const newbtn = oldbtn.filter(e => e !== topic)
return [
{ payload: "", choices: newbtn }
]
See in the example below... should be emptied whenever an item is deleted or all items are deleted. But sometimes it is not. Maybe a mistake in my code, but looks more like issue with logic inside dropdown.
[{"id":"adb7eae63154ed82","type":"change","z":"95e238910d29e0c2","name":"","rules":[{"t":"set","p":"label","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":200,"wires":[["9408f7f8ce7a7483"]]},{"id":"6b55b3797fc1ce3d","type":"debug","z":"95e238910d29e0c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":850,"y":300,"wires":[]},{"id":"540205cc2cd8f831","type":"function","z":"95e238910d29e0c2","name":"add to list","func":"const topic = msg.topic\nvar btn = flow.get(\"btnarray\") || []\nbtn.push(topic)\nflow.set(\"btnarray\", btn)\n\nconst newPayload = flow.get(\"btnarray\") || []\n\nreturn [\n { topic: topic, title: topic },\n { payload: topic, choices: btn }\n];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":160,"y":200,"wires":[["75961e82d73d9aec"],["d7bb96a5b22e1080"]]},{"id":"ec335d92973b49df","type":"function","z":"95e238910d29e0c2","name":"remove from list","func":"var oldbtn = flow.get(\"btnarray\") || []\nconst topic = msg.payload\n\nconst newbtn = oldbtn.filter(e => e !== topic)\n\nflow.set(\"btnarray\", newbtn)\n\nreturn [\n { topic: topic, _delete: true},\n { payload: \"\", choices: newbtn }\n ];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":140,"y":300,"wires":[["75961e82d73d9aec"],["d7bb96a5b22e1080"]]},{"id":"f89c21e8bfab9eb1","type":"http request","z":"95e238910d29e0c2","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://random-word-api.herokuapp.com/word","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":350,"y":120,"wires":[["18c687013e62f435"]]},{"id":"18c687013e62f435","type":"change","z":"95e238910d29e0c2","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"msg.payload[0]","tot":"jsonata"},{"t":"set","p":"title","pt":"msg","to":"msg.payload[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":120,"wires":[["540205cc2cd8f831"]]},{"id":"9408f7f8ce7a7483","type":"fd-label","z":"95e238910d29e0c2","fd_container":"16ba1ce3418bf289","fd_cols":1,"fd_rows":1,"fd_array":false,"fd_array_max":10,"name":"","title":"","popup_info":"","label":"banane","color":"purple-accent-3","align":"center","justify":"center","weight":"400","size":"100%","padding":"4px","x":830,"y":200,"wires":[]},{"id":"d7bb96a5b22e1080","type":"fd-dropdown-select","z":"95e238910d29e0c2","fd_container":"16ba1ce3418bf289","fd_cols":"2","fd_rows":1,"fd_array":false,"fd_array_max":10,"fd_output_topic":"","name":"","title":"Detele Button","popup_info":"","enabled":true,"value":"","choices":[],"labels":[],"allow_multiple":false,"color":"","x":610,"y":300,"wires":[["6b55b3797fc1ce3d","ec335d92973b49df"]]},{"id":"3cb0ab8809391dd3","type":"fd-push-button","z":"95e238910d29e0c2","fd_container":"16ba1ce3418bf289","fd_cols":"2","fd_rows":1,"fd_array":false,"fd_array_max":10,"fd_output_topic":"","name":"add new button","title":"add new button","popup_info":"","enabled":true,"color":"","output_value":25,"icon":null,"x":160,"y":120,"wires":[["f89c21e8bfab9eb1"]]},{"id":"75961e82d73d9aec","type":"fd-push-button","z":"95e238910d29e0c2","fd_container":"6d69e6adc0fd0416","fd_cols":1,"fd_rows":1,"fd_array":true,"fd_array_max":"5","fd_output_topic":"bix","name":"array of buttons","title":"button1","popup_info":"","enabled":true,"color":"","output_value":25,"icon":null,"x":490,"y":200,"wires":[["adb7eae63154ed82"]]},{"id":"7576b5c91ca5324e","type":"fd-push-button","z":"95e238910d29e0c2","fd_container":"16ba1ce3418bf289","fd_cols":"2","fd_rows":1,"fd_array":false,"fd_array_max":10,"fd_output_topic":"","name":"delete all","title":"delete all","popup_info":"","enabled":true,"color":"","output_value":25,"icon":null,"x":140,"y":400,"wires":[["4f6a3c53f61c5610"]]},{"id":"4f6a3c53f61c5610","type":"function","z":"95e238910d29e0c2","name":"delete all from list","func":"var oldbtn = flow.get(\"btnarray\") || []\n\nconst newbtn = []\n\nflow.set(\"btnarray\", newbtn)\n\nreturn [\n oldbtn.map((e) => ({\n topic: e,\n _delete: true\n }))\n,{payload: \"\", choices: []}]\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":400,"wires":[["53dcc48b954c6712","75961e82d73d9aec"],["d7bb96a5b22e1080","b7d412a169a434b2"]]},{"id":"53dcc48b954c6712","type":"debug","z":"95e238910d29e0c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":850,"y":380,"wires":[]},{"id":"b7d412a169a434b2","type":"debug","z":"95e238910d29e0c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":850,"y":420,"wires":[]},{"id":"16ba1ce3418bf289","type":"flexdash container","name":"button static container","kind":"StdGrid","fd_children":",9408f7f8ce7a7483,3cb0ab8809391dd3,d7bb96a5b22e1080,7576b5c91ca5324e","title":"button static container","tab":"5671049acbf17679","min_cols":"1","max_cols":"20","parent":"2e1077589627ac5c","solid":false,"cols":"1","rows":"1"},{"id":"6d69e6adc0fd0416","type":"flexdash container","name":"button container","kind":"StdGrid","fd_children":",75961e82d73d9aec","title":"button container","tab":"5671049acbf17679","min_cols":"1","max_cols":"20","parent":"","solid":false,"cols":"1","rows":"1"},{"id":"5671049acbf17679","type":"flexdash tab","name":"Demo","icon":"mdi-view-dashboard","title":"Demo","fd_children":",2e1077589627ac5c,16ba1ce3418bf289,6d69e6adc0fd0416","fd":"e8f5aea52ab49500"},{"id":"2e1077589627ac5c","type":"flexdash container","name":"Demo grid","kind":"StdGrid","fd_children":",f6032f8e6e47b319","title":"Demo grid","tab":"5671049acbf17679","min_cols":2,"max_cols":6,"parent":"","solid":false,"cols":"1","rows":"1"}]