How do I open results into a Dialog (off_canvas)?

Created on 3 January 2020, over 5 years ago
Updated 8 April 2025, 5 days ago

Hi, I was searching about opening poll module results into a dialog but I didn't find anything about...Can you help me please?

And I was trying to opening by my own, but when I try to render the button via jQuery this always open the "vote" form and not the "result" form.

This is the code:

    var form_action = jQuery("form").attr("action");
    var ver_resultados_btn_div = '<div class="form-group" id="ver_resultados_btn_div"></div>';
    var ver_resultados_btn = '<a id="ver_resultados_btn" class="btn btn-info btn-block use-ajax" href="' + form_action + '">Ver Resultados</a>';

    jQuery(ver_resultados_btn_div).appendTo('[data-drupal-selector="edit-actions"]');
    jQuery(ver_resultados_btn).appendTo('#ver_resultados_btn_div');

    if (jQuery('#encuesta_vigente').has('[data-drupal-selector]')) {
        jQuery('#ver_resultados_btn').attr({
            'data-drupal-selector': 'edit-result',
            'data-dialog-type': 'dialog',
            'data-dialog-renderer': 'off_canvas',
            'name': 'op',
        });
    } else {
        jQuery('#ver_resultados_btn').addClass('webform-dialog-size');
    }

And this is the result:

The first button is the default poll view results button, and the second one is my custom button to open the results into a dialog.

πŸ’¬ Support request
Status

Postponed: needs info

Version

1.0

Component

Documentation

Created by

πŸ‡ΈπŸ‡»El Salvador jashirouprotips

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024