I have multiple blocks on a single page that I would like to load when a button click event is triggered.
I am not clear on how to do this. Can anyone clarify how this is done or point me to the appropriate documentation?

Comments

solarDog created an issue. See original summary.

geoanders’s picture

@solarDog

Blocks that are configured for ajax, get loaded automatically on page load currently. There is no functionality at this time to trigger via button. This would need to be added in.

- Would require a configuration option to trigger via button.
- Pass this configuration to drupal settings on js layer.
- Check for configuration and either load automatically and allow button to trigger block load. Probably have to tie click event against button or render a custom form with ajax button functionality.

geoanders’s picture

Version: 8.x-2.1 » 8.x-2.x-dev
Component: Documentation » Code
geoanders’s picture

Priority: Normal » Minor
nathan tsai’s picture

Looking for a module similar to https://www.drupal.org/project/block_refresh for Drupal 9.

Specifically, refreshing a block every 5 secs (for an auction website).

@geoanders, would you be interested in discussing how we could build this functionality?

I don't mind writing a bit/most of the code.

nathan tsai’s picture

[clicked submit comment too many times]

nathan tsai’s picture

[clicked submit comment too many times]

geoanders’s picture

@nathan-tsai

I would create another feature request ticket for block refresh. As this ticket has a different ask.

geoanders’s picture

Related issues: +#3310506: Refresh ajax block
geoanders’s picture

Version: 8.x-2.x-dev » 3.x-dev
Priority: Minor » Normal

  • geoanders committed c4896b1 on 3.x
    Issue #3284033 - Allow ajax block to be loaded via button.
    
geoanders’s picture

Status: Active » Needs review
geoanders’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.