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

    red-dinner-66239

    11/04/2022, 2:11 PM
    and here its ref=table or ref='table' ?
  • g

    gorgeous-airport-54386

    11/04/2022, 2:11 PM
    both are the same
  • g

    gorgeous-airport-54386

    11/04/2022, 2:12 PM
    in html, quotes are optional if the value is one word
  • r

    red-dinner-66239

    11/04/2022, 2:12 PM
    okok
  • c

    chilly-refrigerator-94141

    11/04/2022, 2:12 PM
    Sorry to bother you again on that, but I can't find the answer for: Is there a JS event to know when hx-boost is "done" ?
  • r

    red-dinner-66239

    11/04/2022, 2:14 PM
    but then it does not work it post nothing ... @gorgeous-airport-54386
  • r

    red-dinner-66239

    11/04/2022, 2:16 PM
    when I click on a table line it doesn't post anything
  • g

    gorgeous-airport-54386

    11/04/2022, 2:17 PM
    does it change anything when you remove
    onclick="myFunction()"
    ?
  • r

    red-dinner-66239

    11/04/2022, 2:19 PM
    no it doesn't change anything
  • g

    gorgeous-airport-54386

    11/04/2022, 2:20 PM
    i don't know what's happening then, maybe someone else can help
  • r

    red-dinner-66239

    11/04/2022, 2:21 PM
    I show you my code maybe I forgot something
    Copy code
    html
    <table ref='table' id="myTable" class="table-1">
                          <thead>
                            <tr>
                              <th></th>
                              <th>N° de commande</th>
                              <th>Type de service</th>
                              <th>Prix</th>
                              <th>Statut</th>
                            </tr>
                          </thead>
                          <tbody>
                            <tr v-for="post in HubriseOrder" style="border-left: solid 5px; border-color:#248b21;" class="btnSelect tr-commande contenttableforpopup" v-bind:hx-post="'{{ request.path }}?id='+ post.id" hx-target=".modal-body" onclick="myFunction()">
                              <td data-label="">
                                <img class="icon-commande"
                                     v-bind:src="'{% get_static_prefix %}apc/images/' + post.pictureplatform">
                              </td>
                              <td data-label="N° de commande">[[post.id_order]]</td>
                              <td data-label="Type de service">[[post.service_type]]</td>
                              <td data-label="Prix">[[post.amount]]</td>
                            </tbody>
                          </table>
  • r

    red-dinner-66239

    11/04/2022, 2:23 PM
    and js 😅
    Copy code
    js
    
                    vueApp = new Vue({
                      el: "#app",
                      delimiters: ["[[", "]]"],
                      data() {
                        return {
                          HubriseOrder: [],
                        };
                      },
                      watch: {
                        HubriseOrder(newOrder, oldOrder) {
                          htmx.process(this.$refs.table);
                        }
                      },
                    });
                                  
                                        var ws = new WebSocket("wss://95a8-2a01-e0a-2bd-f2b0-b1d9-3e81-cb8d-dc59.eu.ngrok.io/ws/");
                                  
                                        ws.onopen = function (e) {
                                          ws.send(
                                            JSON.stringify({
                                              action: "list",
                                              request_id: new Date().getTime(),
                                            })
                                          );
                                        };
                                  
                                        ws.onmessage = function (e) {
                                          allData = JSON.parse(e.data);
                                          if (allData.action === "list") {
                                            vueApp.$data.HubriseOrder = allData.data;
                                            vueApp.$forceUpdate();
                                          } else if (allData.action === "update") {
                                            vueApp.$data.HubriseOrder.push(allData.data);
                                          }
                                        };
  • t

    thankful-apartment-66679

    11/04/2022, 2:23 PM
    may want to make a thread to troubleshoot this particular issue
  • r

    red-dinner-66239

    11/04/2022, 2:25 PM
    I will try to find a solution
    c
    • 2
    • 2
  • r

    red-dinner-66239

    11/04/2022, 2:25 PM
    Thanks anyway @gorgeous-airport-54386
  • c

    calm-ice-23682

    11/04/2022, 5:07 PM
    I will try to find a solution
  • f

    flat-painting-36912

    11/04/2022, 5:21 PM
    How could I achieve this with HTMX ? Specifically concatenating the value of an input to the URL?
  • f

    flat-painting-36912

    11/04/2022, 5:22 PM
    Copy code
    document.querySelector('#room-name-submit').onclick = function(e) {
                var roomName = document.querySelector('#room-name-input').value;
                window.location.pathname = '/chat/' + roomName + '/';
            };
  • c

    calm-ice-23682

    11/04/2022, 5:28 PM
    vimdiesel your javascript is trying to dynamically set the path in the brower address bar based on the value of the input field
  • c

    calm-ice-23682

    11/04/2022, 5:29 PM
    htmx is mainly used for making server requests so what your script is trying to achieve is best done in javascript or hyperscript
  • g

    gorgeous-airport-54386

    11/04/2022, 5:30 PM
    one option: have a server endpoint that accepts the room name as a query param and redirects to the room url
  • g

    gorgeous-airport-54386

    11/04/2022, 5:31 PM
    hx-get="/chat/find-room-by-name"
    ->
    /chat/find-room-by-name?room-name=myroom
    redirects to
    /chat/myroom
  • f

    flat-painting-36912

    11/04/2022, 5:33 PM
    thanks
  • f

    fancy-train-23639

    11/05/2022, 12:58 AM
    I might be missing something obvious, but probably due to my lack of js knowledge, I assumed that I could simply return a custom event through an
    HX-Trigger
    header and handle it in hyperscript, but that doesn't seem to be the case. When trying the following:
    Copy code
    html
    <tr scope="row" _="on deletedContainer-11 then remove me" id="container-11">
                  ...
                </tr>
    I'm getting the following error:
    Copy code
    "Expected commandList
    
    on deletedContainer-11 then remove me
                            ^^
    Any ideas what the issue could be here? I couldn't find any example that covered this case.
  • m

    mysterious-toddler-20573

    11/05/2022, 1:01 AM
    remove that "then"
  • m

    mysterious-toddler-20573

    11/05/2022, 1:01 AM
    no leading "then"
  • m

    mysterious-toddler-20573

    11/05/2022, 1:01 AM
    "then" is like a semi-colon in sane languages
  • m

    mysterious-toddler-20573

    11/05/2022, 1:21 AM
    https://htmx.org/posts/2022-11-04-htmx-1.8.3-is-released/
  • f

    fancy-train-23639

    11/05/2022, 1:28 AM
    Oh, I added it out of desperation because I saw an example that had it, but without it, I'm getting:
    Copy code
    "
    "Expected commandList
    
    on deletedContainer-11 remove me
                       ^^
  • f

    fancy-train-23639

    11/05/2022, 1:30 AM
    What I did not see is an example using a custom event, so I'm wondering if I'm not actually meant to use custom events?
1...891892893...1146Latest