finos / finos/regular-table

Add Support for Content Types like NodeList

Open
#98 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
403
Forks
43
Avg merge
3m
Merged PRs (30d)
1

Description

## Feature Request

### Description of Problem:
I'm trying to convert existing tables to regular-table. These tables use multiple HTML elements like buttons with hover. When multiple elements are not wrapped in a single `HTMLElement` they can currently not be added to a `td`.

### Potential Solutions:
I've currently monkey patched this:
```js
} else if (val instanceof NodeList) {
td.textContent = "";

Array.prototype.forEach.call(val, (node) => {
td.appendChild(node.cloneNode(true));
});
} else {
```
To stay in line with the rest this should probably only use appendChild without clone, but this would require a clone in the data listener, as these nodes are lost when they leave the view.

A more general alternative would a custom callback. This would maybe also allow usage of `removeChild` to keep a single instance of the nodes, which may be faster.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.