- Issue created by @msn5158
- πΊπΈUnited States fathershawn New York
I haven't had time to produce any videos.
If you are attaching our
htmx/drupal
asset library, then the only thing I can see in your code is to revisit the documentation for hx-select. I suspect that value needs to bearticle
since node markup is typically wrapped in that tag. I think you are seeing no response because there is no content withid="drupal-off-canvas-wrapper"
in the response. - Status changed to Needs review
6 months ago 12:59pm 12 June 2024 I know now, it is the wrong by hx-select, it uses the selector from the page of hx-get.
Also, can it obtain data from different domains?
{{ attach_library('htmx/drupal') }} <button hx-get="https://abc.website.com/node/1" hx-target="#drupal-off-canvas-wrapper" hx-select="#page-wrapper" hx-swap="outerHTML ignoreTitle:true" class="button"> Add </button> <div id="drupal-off-canvas-wrapper" >11</div>
I tested it doesn't work.
- πΊπΈUnited States fathershawn New York
You should be able to do that unless there is something going on. See
htmx.config.selfRequestsOnly in
https://htmx.org/reference/#configSee our documentation on Drupal asset libraries, also attach the debug library and add the given attribute to you markup or an ancestor. You will get console logging for all HTMX activity on that tag or its descendants.
- Status changed to Postponed: needs info
6 months ago 11:48am 13 June 2024 I now understand how to extract data from a page into current page, but there are still many questions that I don't understand, such as creating a block view or a non page view without a separate URL. How can I use HTMX to load the result set of the view onto a page?Can it do? not from URL page.
{{ attach_library('htmx/drupal') }} //<button hx-get="/htmx/node/1/teaser" <button hx-get="/htmx/views/content_recent/block_1" // I know it's wrong, I'm just using it to illustrate the issue. hx-target="#drupal-off-canvas-wrapper" hx-select="#page-wrapper" hx-swap="outerHTML ignoreTitle:true" class="button"> Add </button> <div id="drupal-off-canvas-wrapper" >11</div>
- πΊπΈUnited States fathershawn New York
We haven't done anything targeted at views, but a block display is probably your best bet. See if this meets your need:
- Build the block display
- Browse to
/admin/structure/htmx-block
and create an HTMX block that displays your view block display, which essentially is a Drupal block without a region. - Display your block in one of 2 ways, see Displaying HTMX Blocks
References:
routehtmx_blocks.view
- Status changed to Needs review
6 months ago 7:36pm 13 June 2024 - Status changed to Fixed
6 months ago 12:25pm 18 June 2024 Automatically closed - issue fixed for 2 weeks with no activity.