Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8410181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:06:38+00:00 2026-06-10T00:06:38+00:00

I’m trying to open a dialog which shows information about an event. There one

  • 0

I’m trying to open a dialog which shows information about an event. There one can use the buttons to open another dialog which allows to edit the event and one that deletes the event.

The problem is that on the first attempt to open the editing-dialog, nothing happens, while the delete-dialog functions perfectly. After closing the main dialog and reopening, the editing-dialog shows as well when clicking the button.

I suppose it has something to do with the view of the editing-dialog, because the delete-dialog has none and opens correctly.
It’s no ajax problem (the event is fetched from a database), it’s loaded before initialisation of the dialogues.

The dialogues are called within the same Element “eventDialog” and correctly removed after closing the main dialog.

Thanks in advance 🙂

Heres some of the code:

Main Dialog

$.Controller('COPD.Controller.PatientHeader.Dialog',
/** @Static */
{   
defaults: {
    patientID: 2,
    eventID: 0,
},

},
/** @Prototype */
{
/*
 * All of this class' work is done in this constructor
 */

init : function(){

    this.element.append('<span id=\"eventDialog\"></span>');
    $('#eventDialog').html('COPD/controller/patient_details/controller/patient_header/views/patientHeaderDialog.ejs', 
            {event: COPD.Models.TreatmentEvent.findOneDebug({behandlungsEventID: this.options.eventID},
            this.proxy(function(success) {
                $("#eventDialog").dialog({
                    show:"fade",
                    hide:"fade",
                    height:"auto",
                    width:500,
                    draggable:false,
                    resizable:false,
                    modal:true,
                    position:"center",
                    title:success[0].behandlungskategorie.name,
                    create: this.proxy(function(){this.initDialogs(success);}),
                    close: this.proxy(function(){this.destroy();}),
                    buttons: [{text:"Bearbeiten", click: this.proxy(function() {this.openEditEvent();})},
                              {text:"Löschen", click: this.proxy(function() {this.openDeleteEvent();})},
                              {text:"Schließen", click: function() {$(this).dialog("close");}},],
                });

            }))});
},

// Standard destroy()-Funktion
destroy : function() {
    $('#eventDialog').copd_patient_header_dialog_edit("destroy");
    $('#eventDialog').copd_patient_header_dialog_delete("destroy");
    $('#eventDialog').remove();
    this._super();
},

initDialogs : function(event) {
    $('#eventDialog').copd_patient_header_dialog_delete({event: event});
    $('#eventDialog').copd_patient_header_dialog_edit({event: event});
},

openEditEvent : function() {
    $('#editEvent').dialog("open");
},

openDeleteEvent : function() {
    $('#deleteEvent').dialog("open");
},


});

});

Editing Dialog

$.Controller('COPD.Controller.PatientHeader.Dialog.Edit',
/** @Static */
{   
defaults: {
    patientID: 2,
    eventID: 0,
    event: null,
},

},
/** @Prototype */
{
/*
 * All of this class' work is done in this constructor
 */

init : function(){
    console.log("Der Edit-Event-Dialog wird jetzt initialisiert!");
    this.element.append('<span id=\"editEvent\"></span>');
    $("#editEvent").html('COPD/controller/patient_details/controller/patient_header/views/patientHeaderDialogEdit.ejs', {
        behandlungskategorien: COPD.Models.TreatmentCategory.findAll(),
        event: this.options.event[0],
    }, this.proxy(function() {
        $("#editEvent").dialog({
            show:"fade",
            hide:"fade",
            height:"auto",
            width:500,
            draggable:false,
            resizable:false,
            modal:true,
            autoOpen:false,
            title:this.options.event[0].behandlungskategorie.name + " bearbeiten",
            buttons: [{text:"Speichern", click: this.proxy(function(){this.updateEvent();})},
                      {text:"Schließen", click: function(){$(this).dialog("close");}},],

        });
    }));
    console.log("Event:", this.options.event[0]);
},

// Standard destroy()-Funktion
destroy : function() {
    $('#editEvent').remove();
    this._super();
},

updateEvent : function() {
//updates the event
},


});

});

Delete Dialog

$.Controller('COPD.Controller.PatientHeader.Dialog.Delete',
/** @Static */
{   
defaults: {
    patientID: 2,
    eventID: 0,
    event: null,
},

},
/** @Prototype */
{
/*
 * All of this class' work is done in this constructor
 */

init : function(){
    console.log("Der Delete-Event-Dialog wird jetzt initialisiert!");
    this.element.append('<span id=\"deleteEvent\"></span>');
    $("#deleteEvent").html('<br>Wollen Sie wirklich das Behandlungsevent löschen?<br><br>\''+ this.options.event[0].behandlungskategorie.name + '\'<br>' + this.options.event[0].hinweisText);
    $("#deleteEvent").dialog({
        show:"fade",
        hide:"fade",
        height:"auto",
        width:500,
        draggable:false,
        resizable:false,
        modal:true,
        autoOpen:false,
        position:"center",
        title:"Wirklich Löschen?",
        buttons: [{text:"Ja", click:function()    {this.hideEvent(this.options.event);}},
                  {text:"Nein", click:function()    {$(this).dialog("close");}},],
    });
},

// Standard destroy()-Funktion
destroy : function() {
    $('#deleteEvent').remove();
    this._super();
},

hideEvent : function() {

}


 });

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:06:39+00:00Added an answer on June 10, 2026 at 12:06 am

    Problem solved, after a lot of googling and looking at xmlHttpRequests I realized it was a synchronisation problem. The views had been loaded before even the data has been fetched, which should actually not happen.

    Using the $.when(fetchItems()).done(function(itemsFetched) { //doSomething }) function offered by the jquery.Model plugin made the view wait for the data to be loaded and initialized it afterwards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I'm trying to select an H1 element which is the second-child in its group
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.