Logic Machine Forum
Open a widget from another widget - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Open a widget from another widget (/showthread.php?tid=2363)



Open a widget from another widget - davidchispas - 26.11.2019

Hi. I am creating a visualization. I created a home page with a button called "lighting", when I click, I open a widget with different options, and when selecting the desired option, I want to open another widget and keep the first one. It's possible?


RE: Open a widget from another widget - admin - 27.11.2019

Button that opens main widget must have static-widget Additional class. In Custom JS change number in widget ID (widget-23) to your widget ID (you can view this in browser dev tools (F12)). Your widget must used fixed position that can be set in widget settings. Main widget can only be closed by clicking on the button that opens it or by changing plans. Other widgets are closed by clicking outside of widget area.

Custom CSS:
Code:
.force-show {
  display: block !important;
}

Custom JS:
Code:
$(function() {
  var widget = $('#widget-23').removeClass('layer').css('position', 'absolute');
  
  $(document.body).on('showplan', function() {
    widget.removeClass('force-show');
  });
  
  $('.static-widget').on('vclick', function() {
    widget.toggleClass('force-show', !widget.hasClass('hide'));
  });
});



RE: Open a widget from another widget - davidchispas - 29.11.2019

(27.11.2019, 09:27)admin Wrote: Button that opens main widget must have static-widget Additional class. In Custom JS change number in widget ID (widget-23) to your widget ID (you can view this in browser dev tools (F12)). Your widget must used fixed position that can be set in widget settings. Main widget can only be closed by clicking on the button that opens it or by changing plans. Other widgets are closed by clicking outside of widget area.

Custom CSS:
Code:
.force-show {
  display: block !important;
}

Custom JS:
Code:
$(function() {
  var widget = $('#widget-23').removeClass('layer').css('position', 'absolute');
 
  $(document.body).on('showplan', function() {
    widget.removeClass('force-show');
  });
 
  $('.static-widget').on('vclick', function() {
    widget.toggleClass('force-show', !widget.hasClass('hide'));
  });
});
Hi. With your steps I can block the widget, but the second widget can't keep it in sight, it opens and closes quickly. Will I need any more parameters?


RE: Open a widget from another widget - admin - 02.12.2019

Can you send your backup via PM?


RE: Open a widget from another widget - davidchispas - 02.12.2019

(02.12.2019, 14:12)admin Wrote: ¿Puedes enviar tu copia de seguridad a través de PM?
Hola. Detecté la falla y la puse a trabajar. Pero eso tampoco sería correcto.

Necesito configurar una página de "1360 x 768" y en la configuración de visualización "visto en PC / Tablet-> Páginas centrales, el tamaño es autorregulado" Así que obtengo cualquier monitor para ajustar la imagen de mi proyecto. Pero cuando da esta configuración, el widget se desvanece de su posición. Tampoco puedo darle un efecto de transición de página.

Usuario / Pase: admin / 12345678


RE: Open a widget from another widget - admin - 03.12.2019

Try installing 2019 RC1 firmware, positioning work correctly for me in this version. If you need multiple widgets it's better to use different classes (static-widget1 and static-widget2). Transitions will not work.

Code:
$(function() {
  var w1 = $('#widget-2').removeClass('layer').css('position', 'absolute');
  var w2 = $('#widget-4').removeClass('layer').css('position', 'absolute');
  
  $(document.body).on('showplan', function() {
    w1.removeClass('force-show');
    w2.removeClass('force-show');
  });
  
  $('.static-widget1').on('vclick', function() {
    w2.removeClass('force-show');
    w1.toggleClass('force-show', !w1.hasClass('hide'));
    hideWidgets();
  });

  $('.static-widget2').on('vclick', function() {
    w1.removeClass('force-show');
    w2.toggleClass('force-show', !w2.hasClass('hide'));
    hideWidgets();
  });
});



RE: Open a widget from another widget - davidchispas - 03.12.2019

(03.12.2019, 07:30)admin Wrote: Try installing 2019 RC1 firmware, positioning work correctly for me in this version. If you need multiple widgets it's better to use different classes (static-widget1 and static-widget2). Transitions will not work.

Code:
$(function() {
  var w1 = $('#widget-2').removeClass('layer').css('position', 'absolute');
  var w2 = $('#widget-4').removeClass('layer').css('position', 'absolute');
 
  $(document.body).on('showplan', function() {
    w1.removeClass('force-show');
    w2.removeClass('force-show');
  });
 
  $('.static-widget1').on('vclick', function() {
    w2.removeClass('force-show');
    w1.toggleClass('force-show', !w1.hasClass('hide'));
    hideWidgets();
  });

  $('.static-widget2').on('vclick', function() {
    w1.removeClass('force-show');
    w2.toggleClass('force-show', !w2.hasClass('hide'));
    hideWidgets();
  });
});
effectively! the problem is corrected with the new version of firm. Anyway, the effect of page transition continues to affect the widget, I do not mind removing it, but in case you want to take it into account in the next update.

Thank you very much