https://htmx.org logo
Join Discord
Powered by
# 🔥-django-htmx
  • b

    bitter-monkey-50309

    08/30/2022, 4:36 PM
    Another I'm liking is https://pypi.org/project/slippers/
  • r

    refined-waiter-90422

    08/30/2022, 9:17 PM
    Pretty crazy how naturally LoB tailwind is in combination with Hyperscript and HTMX
  • m

    mysterious-toddler-20573

    08/30/2022, 9:39 PM
    yeah, I have yet to take the tailwind pill, but it seems like folks really like it
  • r

    refined-waiter-90422

    08/30/2022, 10:17 PM
    Same here man. After watching that though, combining everything in one file like that seems hella tempting for rapid development.
  • h

    hundreds-camera-24900

    08/30/2022, 11:42 PM
    tailwind is nice, people can go real fast with it
  • h

    hundreds-camera-24900

    08/30/2022, 11:42 PM
    I am not convinced the long term is as good
  • a

    ancient-father-3063

    08/31/2022, 12:48 PM
    weird error that I'm only getting on my heroku deployment (can not reproduce locally)
  • a

    ancient-father-3063

    08/31/2022, 12:48 PM
    htmx:targetError
  • a

    ancient-father-3063

    08/31/2022, 12:48 PM
    I'm getting that in the console, and it says "logError @ devhtmx.8b5ad8be1763.js:1846"
  • a

    ancient-father-3063

    08/31/2022, 12:49 PM
    but how can I view that log?
  • a

    ancient-father-3063

    08/31/2022, 12:49 PM
    it's an hx-get, hx-target thing. Why would that give me an error? And why only on heroku deployment? I'm not sure how to troubleshoot this.
  • a

    ancient-father-3063

    08/31/2022, 12:52 PM
    Oh, ok, I figured something out. The target div is simply not there. Why that is I have no idea, but that's not really an htmx problem.
  • a

    ancient-father-3063

    09/01/2022, 12:00 PM
    Ok, new problem
  • a

    ancient-father-3063

    09/01/2022, 12:00 PM
    So I want to include a table on one of my pages, but I wanted to write the logic and html for that table separately from the page. So in my html I "{% include 'partials/statstable.html' %}"
  • a

    ancient-father-3063

    09/01/2022, 12:01 PM
    I also use htmx to load the data for the table, calling it from one of my filter selects
  • a

    ancient-father-3063

    09/01/2022, 12:01 PM
    Copy code
    html
                        <select id="deckname" name="deckname" hx-trigger="load, change" hx-get="{% url 'statstable' %}" hx-target="#statstable" hx-swap="outerHTML" hx-include="#timeframe, #filteroutunplayed">
  • a

    ancient-father-3063

    09/01/2022, 12:02 PM
    This way the page loads with an empty table and htmx quickly fills it up and if the user changes the filter select it will change the table info
  • a

    ancient-father-3063

    09/01/2022, 12:02 PM
    I hope this all makes sense.
  • a

    ancient-father-3063

    09/01/2022, 12:03 PM
    The trouble is now I want to add DataTable to the table to make it sortable, I do that with this jquery script
  • a

    ancient-father-3063

    09/01/2022, 12:03 PM
    Copy code
    html
        <script>
            $(document).ready( function () {
            $('#statstable').DataTable();
            } );
        </script>
  • a

    ancient-father-3063

    09/01/2022, 12:04 PM
    but when I put that in my table, every time htmx loads the table again I get a second instance of the DataTable!
  • a

    ancient-father-3063

    09/01/2022, 12:04 PM
    thats the problem
  • h

    hundreds-camera-24900

    09/01/2022, 2:50 PM
    your problem is using datatable at all lol
  • h

    hundreds-camera-24900

    09/01/2022, 2:51 PM
    yeah swapping the content isn't going to destroy the datatable instance - you'd probably need to do something like update/reinit
  • h

    hundreds-camera-24900

    09/01/2022, 2:51 PM
    but if you just want swapping just do that server side imho
  • h

    hundreds-camera-24900

    09/01/2022, 2:51 PM
    way less effort
  • b

    brash-electrician-16054

    09/01/2022, 2:57 PM
    You can probably use
    htmx:configRequest
    to set the DataTable. Or perhaps
    htmx:load
    https://htmx.org/events/#htmx:configRequest
  • h

    hundreds-camera-24900

    09/01/2022, 5:21 PM
    his problem isn't that it's not getting initialized, it's that it's getting initialized multiple times
  • h

    hundreds-camera-24900

    09/01/2022, 5:23 PM
    Probably something like:
    Copy code
    js
     if $('#statstable').isDataTable(){
       $('#statstable').destroy()
     }
     $('#statstable').DataTable();
  • h

    hundreds-camera-24900

    09/01/2022, 5:23 PM
    https://datatables.net/reference/api/%24.fn.dataTable.isDataTable()
1...707172...100Latest