https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • g

    gorgeous-airport-54386

    03/06/2023, 9:39 PM
    If you have an element that wraps the code you sent, you can add
    hx-sync="this:replace"
    and it should be inherited to the projects
  • h

    hallowed-pillow-66838

    03/06/2023, 9:41 PM
    I tried that in a first place and it doesn't work https://discord.com/channels/725789699527933952/725789747212976259/1082292199506575482
  • h

    hallowed-pillow-66838

    03/06/2023, 9:44 PM
    I tried now and still nothing
  • t

    tall-dinner-62086

    03/06/2023, 10:16 PM
    You are still using the same id for every single project div
  • t

    tall-dinner-62086

    03/06/2023, 10:16 PM
    Having multiple elements with the same id is not valid html
  • t

    tall-dinner-62086

    03/06/2023, 10:24 PM
    Also I don't understand your
    <h3>
    that you never close and it looks like you're trying to cram an
    h4
    and a
    p
    inside it
  • t

    tall-dinner-62086

    03/06/2023, 10:25 PM
    you also never close your
    <p>
    but browsers let you get away with all that
  • m

    mammoth-family-48524

    03/06/2023, 10:27 PM
    I added a try/catch at that line and it is indeed where the error happens.
  • t

    tall-dinner-62086

    03/06/2023, 10:53 PM
    @hallowed-pillow-66838 is this close to the behavior you need?
  • t

    tall-dinner-62086

    03/06/2023, 10:54 PM
    I'm using some inline scripts to emulate the HX-Trigger responses
  • t

    tall-dinner-62086

    03/06/2023, 10:54 PM
    so ignore those
  • t

    tall-dinner-62086

    03/06/2023, 10:54 PM
    and pretend there are HX-Trigger headers in the response
  • m

    mysterious-toddler-20573

    03/06/2023, 11:06 PM
    😑 OKOK
  • m

    mysterious-toddler-20573

    03/06/2023, 11:06 PM
    are you willing to run a custom htmx build for a bit?
  • m

    mammoth-family-48524

    03/06/2023, 11:15 PM
    Sure 👍. It’s for a low traffic site if that matters
  • h

    hallowed-pillow-66838

    03/07/2023, 6:56 AM
    @tall-dinner-62086 yes, the behaviour is what I'm looking for but we have a few important differences in our html codes. Before I describe those I will try to implement the idea on how I may solve this using your logic. Will come back with a result.
  • h

    hallowed-pillow-66838

    03/07/2023, 7:49 AM
    @tall-dinner-62086 I made it! Only because you made me think about those unique id's twice with your demo. Thank you very much!
  • l

    lemon-doctor-84389

    03/07/2023, 11:28 AM
    Is there a simple way to make
    hx-redirect
    (or something else) open a new tab?
    • 1
    • 1
  • w

    white-eve-2931

    03/07/2023, 4:15 PM
    Is there a way to delete a div like this
    hx-swap="delete" hx-trigger="click" hx-target="#divid"
    without sending a request? (I've modal that I would like the user to be able to close if they don't need it)
  • t

    tall-dinner-62086

    03/07/2023, 4:16 PM
    Not with just htmx, no. Could sprinkle some hyperscript in,
    _="on click remove <#divid/>"
  • w

    white-eve-2931

    03/07/2023, 4:17 PM
    I haven't heard of hyperscript :-D, thanks will look into it
  • t

    tall-dinner-62086

    03/07/2023, 4:18 PM
    Wait I was wrong
  • t

    tall-dinner-62086

    03/07/2023, 4:18 PM
  • t

    tall-dinner-62086

    03/07/2023, 4:19 PM
    good ol'
    #
  • r

    rapid-umbrella-80895

    03/07/2023, 4:54 PM
    Hello all! In a django project in a html file I have a with 100 -s in it. Originally there were 80 tables and there are 20 new ones. I’d like to update the content of 80 out of the 100 tables with a request using htmx (currently using hx-swap-oob="true" and using the id of the div that includes the 100 tables). Which is the best option to quickly update the 80 tables: - Update the whole , so update all 100 tables - I tried this and it made the refresh quite slow, so Im looking for an alternative solution - Putting those 20 tables that I don’t want to update inside django templating variables (which checks if it is a first load or a htmx update), so this part is only rendered at the first load and not returned for the htmx request - this saves some time but still significantly slower than when I only had the 80 tables - Instead of swapping the whole , swapping the 80 tables explicitly, so the new 20 tables won’t affect the htmx reload - I have not tried this approach and not sure if it would make sense - Any other suggestion?
  • t

    tall-dinner-62086

    03/07/2023, 5:04 PM
    I'm sorry but I'm stuck on the "100 tables" part of your issue
  • t

    tall-dinner-62086

    03/07/2023, 5:04 PM
    How? Why? Who?
  • t

    tall-dinner-62086

    03/07/2023, 5:06 PM
    I would separate your tables into two divs, one "dynamic" div for the ones you want to update and one "static" div for the ones you don't, then swap the entire "dynamic" div
  • t

    tall-dinner-62086

    03/07/2023, 5:06 PM
    oob-swap is gonna be slow if you're swapping 80 of the dang things
  • r

    rapid-umbrella-80895

    03/07/2023, 5:43 PM
    Thats a fair question. I just simplified my problem, that's why I described as you read it. In reality, the main html is composed of 60 htmls (with includes), and it is dynamically decided at each url path which 60 htmls will be shown based on list variable (with the paths of the 60 htmls) coming from the backend. (There approx. 200 htmls in total, out of these 200, 60 should be included in this case) Each of these 60 html files have 4 -s inside. Basically, I would like to update the content of the tables in all these 60 included htmls in a way that only the first 3 html tables are updated and not the fourth one in each file. I hope it makes sense, I just did not want to make the question complicated.
1...106010611062...1146Latest