Semantic-UI loader inside <table>

PyQL picture PyQL · Jan 28, 2016 · Viewed 10.5k times · Source

I'm using ajax to update a table's contents, I would like to use the semantic-ui's built-in class "Loader" to show some loading animation at the center of the table while getting the contents but that does not seem to work with <table> tag.

<div class="ui active loader">
  <table class="ui unstackable striped table segment">
    <tr><td>id</td><td>name</td></tr>
    <tr><td>1</td><td>test test</td></tr>
  </table>
</div>

How do I get this to work?

Answer

user2867288 picture user2867288 · Jan 28, 2016

A loader is not meant to contain the thing that's loading. It's used in conjunction with a dimmer.

<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet" />
<div class="dimmable">
  <div class="ui active inverted dimmer">
    <div class="ui loader"></div>
  </div>
  <table class="ui unstackable striped table segment">
    <tr>
      <td>id</td>
      <td>name</td>
    </tr>
    <tr>
      <td>1</td>
      <td>test test</td>
    </tr>
  </table>
</div>

Or it can be standalone if inside a segment

<link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet" />
<div class="ui basic segment">
  <div class="ui active loader"></div>
  <table class="ui unstackable striped table segment">
    <tr>
      <td>id</td>
      <td>name</td>
    </tr>
    <tr>
      <td>1</td>
      <td>test test</td>
    </tr>
  </table>
</div>