# Looking for really simple example of editableList

**URL:** https://discourse.nodered.org/t/looking-for-really-simple-example-of-editablelist/88004
**Category:** Developing Nodes
**Created:** [16 May 2024 08:22 UTC](https://discourse.nodered.org/t/looking-for-really-simple-example-of-editablelist/88004 "2024-05-16T08:22:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [16 May 2024 08:22 UTC](https://discourse.nodered.org/t/looking-for-really-simple-example-of-editablelist/88004/1 "2024-05-16T08:22:20Z")

</div>

Can anyone point me to a really simple example of the use of editableList? I am trying to use it to create an array of simple objects, each consisting of a couple of numbers and a string. I am looking at the code for the switch node but I am struggling to see the wood for the trees as most of the code is to do with the complexities of the data rather than the list itself, and I have little experience in the html area.

---

<div class="post-metadata">

### Author: ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)
#### Post date: [16 May 2024 09:21 UTC](https://discourse.nodered.org/t/looking-for-really-simple-example-of-editablelist/88004/2 "2024-05-16T09:21:28Z")

</div>

I don't know if this will be clear to you but I did [this](https://github.com/GogoVega/node-red-contrib-firebase-realtime-database/blob/97c262bdab85f37ce24d7832369ccc94984cbd7d/resources/constraints-container.js#L29) if you're interested.

[EDIT]: I have a simpler example [here](https://github.com/GogoVega/Firebase-Config-Node/blob/899c317132733728dd40ad8ff19afd7735474c9e/resources/claims-container.js#L50).

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [16 May 2024 10:40 UTC](https://discourse.nodered.org/t/looking-for-really-simple-example-of-editablelist/88004/3 "2024-05-16T10:40:55Z")

</div>

That has confused me further, as it seems to be handling it in a different way to that in, for example, the [switch node](https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/nodes/core/function/10-switch.html). It is specifically `oneditprepare()` where I am having problems with understanding what I need to do.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [16 May 2024 10:49 UTC](https://discourse.nodered.org/t/looking-for-really-simple-example-of-editablelist/88004/4 "2024-05-16T10:49:56Z")

</div>

Looking through the core code, I think the ActionList dropdown includes one of the more straight-forward uses of `editableList`:

> <https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/editor-client/src/js/ui/actionList.js#L99>

1. You create an `<ol>` element, convert it to an `editableList`.
2. in the config for the list, you provide an `addItem` function that is called whenever there is an item to add to the list. It is provided a `container` which is the parent DOM element for the item, along with the data item itself. It's then over to you to create the list item's DOM representation inside `container`.

There are a number of configuration options and functionality around sorting and filtering. All documented here [EditableList Widget : Node-RED](https://nodered.org/docs/api/ui/editableList/), albeit without an end-to-end example to help get started..

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [16 May 2024 11:08 UTC](https://discourse.nodered.org/t/looking-for-really-simple-example-of-editablelist/88004/5 "2024-05-16T11:08:31Z")

</div>

Thanks, I will have a look.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [15 July 2024 11:08 UTC](https://discourse.nodered.org/t/looking-for-really-simple-example-of-editablelist/88004/6 "2024-07-15T11:08:43Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
