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

Allow to create lists without a container #738

Open
llagerlof opened this issue Sep 8, 2021 · 0 comments
Open

Allow to create lists without a container #738

llagerlof opened this issue Sep 8, 2021 · 0 comments

Comments

@llagerlof
Copy link

Is it possible to create a List without the need of a container? Because putting a div to act as a container changes the DOM parent-child structure if someone (aka: me) put this into some pre-existing project.

Let's look at your examploe below. It works perfectly, but I really need to create a parent container like, in this example, (<div id="users">)? Is there some way I can have a list just from the <tbody class="list"> without creating a parent element?

<div id="users">
  <input class="search" placeholder="Search" />
  <button class="sort" data-sort="name">
    Sort by name
  </button>
  <table>
    <!-- IMPORTANT, class="list" have to be at tbody -->
    <tbody class="list">
      <tr>
        <td class="name">Jonny Stromberg</td>
        <td class="born">1986</td>
      </tr>
      <tr>
        <td class="name">Jonas Arnklint</td>
        <td class="born">1985</td>
      </tr>
    </tbody>
  </table>

</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/list.js/1.5.0/list.min.js"></script>
<script>
var options = {
  valueNames: [ 'name', 'born' ]
};
var userList = new List('users', options);
</script>
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

1 participant