Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Visualisierung
    4. [Teilweise gelöst] Widgetentwicklung: Widget unique (nur einmal einfügbar) - Geht das?

    NEWS

    • Neues Video "KI im Smart Home" - ioBroker plus n8n

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    [Teilweise gelöst] Widgetentwicklung: Widget unique (nur einmal einfügbar) - Geht das?

    This topic has been deleted. Only users with topic management privileges can see it.
    • snador
      snador last edited by

      Hallo in die schlaue Runde! Ich teste gerade in der Widget Entwicklung herum… Gibt es eine Möglichkeit (z.B. Attribute) um ein Widget unique zu machen? Also es soll in der VIS nur einmal einfügbar sein. Geht das von Haus aus oder gibt es einen praktikablen Weg? Danke für eure Hilfe!

      P.S. Mit Javascript checke ob das Widget schon in der View eingefügt wurde kann ich und ich kann auch das HTML entfernen. Aber mir fehlt eine Routine das Drag an Drop zu stoppen oder nach einer Nachricht das Widget richtig zu killen...

      1 Reply Last reply Reply Quote 0
      • snador
        snador last edited by

        Also so geht es schon mal 🙂 Eventuell kennt jemand noch einen saubereren Weg.

        Ist das Widget in der Toolbox: #prev_container_tplNightingaleWidgetGlobalSet

        Ist das Widget im VIS View: .ngl_widget_globalset

        initView: function () {
        
                // Unique Widget Global Options
                window.setTimeout(function () {
        
        	        $('#panel_body #pan_add_wid #toolbox #prev_container_tplNightingaleWidgetGlobalSet').on('mousedown', function(event) {
        				if($('#panel_body #vis_container .ngl_widget_globalset').length){
        					event.preventDefault();
        					event.stopPropagation();
        					alert('Das Widget kann nur einmal verwendet werden und ist schon vorhanden!');
        				}
        			});
        
        		}, 500);
        
            },
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        Support us

        ioBroker
        Community Adapters
        Donate

        808
        Online

        32.1k
        Users

        80.7k
        Topics

        1.3m
        Posts

        1
        2
        362
        Loading More Posts
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes
        Reply
        • Reply as topic
        Log in to reply
        Community
        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
        The ioBroker Community 2014-2023
        logo