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 HTML in table messages #408

Open
3 tasks done
bubbletroubles opened this issue Nov 17, 2024 · 1 comment
Open
3 tasks done

Allow HTML in table messages #408

bubbletroubles opened this issue Nov 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@bubbletroubles
Copy link
Contributor

Describe the bug
When using simple-datatables (latest), the HTML is shown in the table, but not actually rendered
Changing it to use v5, the problem goes away (e.g. in the jsfiddle examples above, the spinner is shown for 10 seconds in the working one. In the broken one, it dispalys <div class="spinner-border" role="status"> <span class="visually-hidden">Loading...</span> </div>

To Reproduce

Steps to reproduce the behavior:

  1. Create code as per the jsfiddle request which uses dataTable.setMessage
  2. Configure the code as per the sample code block below
  3. Use the CDN files with latest version
  4. The HTML is written, but not rendered
  5. Update the CDN files to pin to version 5
  6. The HTML is rendered
    dataTable.setMessage(`
    <div class="spinner-border" role="status">
        <span class="visually-hidden">Loading...</span>
    </div>
    `);

Expected behavior
When using latest the HTML should be rendered.

Additional context
Here are the CDNs used

    <link
      href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css"
      rel="stylesheet"
      type="text/css"
    />
    <script
      src="https://cdn.jsdelivr.net/npm/simple-datatables@latest"
      type="text/javascript"
    ></script>
@bubbletroubles bubbletroubles added the bug Something isn't working label Nov 17, 2024
@bubbletroubles bubbletroubles changed the title [BUG] [BUG] Using simple-datatables@latest writes, but does not render HTML Nov 17, 2024
@bubbletroubles bubbletroubles changed the title [BUG] Using simple-datatables@latest writes, but does not render HTML [BUG] Using simple-datatables@latest displays, but does not render HTML Nov 17, 2024
@johanneswilm
Copy link
Member

@bubbletroubles Thanks for the example. It s a feature, not a bug. SDT was a mess back in the V5 days. I would not recommend to look at that at all. We now sanitize the input so that users even can use < and > in their status messages. It is not set up for you to add custom HTML elements there.

I take it your goal is to show a spinner in front of the tabel at certain times while waiting for data from the server. Can you not put such a spinner in front of the table in your own code? If there is a reason that is not possible, we could discuss adding some kind of class to the message so that you can then shwo the spinner based on the appearance of that.

@johanneswilm johanneswilm added enhancement New feature or request and removed bug Something isn't working labels Feb 2, 2025
@johanneswilm johanneswilm changed the title [BUG] Using simple-datatables@latest displays, but does not render HTML Allow HTML in table messages Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants