Answer the question
In order to leave comments, you need to log in
How to open modal window with "view" event of FullCalendar in Yii2?
Hello.
I currently have a modal window set up with the "create" page:
$.ajax({
url: 'events/create',
type: "GET",
data: {
date: date
},
success: function(data) {
$('#crEvent').modal('show')
.find('#modalContent')
.html(data);
},
error: function() {
alert('Error');
}
});
Answer the question
In order to leave comments, you need to log in
Many thanks to everyone, and especially Maxim Fedorov , for the discussion and help!
I am attaching here the code of my files (those that I changed), perhaps it will be useful to someone.
EventsController
When you click on an existing event, information about it opens, the same "Edit" and "Delete" buttons are on top (standard when generating CRUD), only the "Edit" button now calls the editing page for this event inside this modal window. It is always possible to go back to the information using the "Back to info" button added in the new condition in _form.php.
If you need to display data in a popup, then it is better to use the appropriate response of the component, ala:
$('#calendar').fullCalendar({
eventClick: function(calEvent, jsEvent, view) {
url = 'http://site.com/default/view?id=' + calEvent.id;
// тут аяксом загружаем контент для отображения с url
// выводим его в ранее заготовленную всплывашку
// и отображаем ее
}
});
If there are a lot of modals in the project and they load the content with ajax, then it's easier to make one modal and the loading code, which is parameterized through the data attributes of the button that calls it. For example:
describe what you mean, what events do you have?
How can I make a click on an event if "click" is "event"
Apparently you call events something completely different?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question