D
D
Dmitro Rak2016-05-31 10:44:50
Yii
Dmitro Rak, 2016-05-31 10:44:50

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');
            }
        });

Now I need to call "view" for each event, and also in a modal window (and then, respectively, "update").
Here I was told how to go to "view" just like a page. And how now with the same event (click on the event) to call the desired "view" in the modal window?
Thank you.
UPD.
3bad0e57bc274bae8a6312086cc52751.png
I need to bring up a window with information for the event that I clicked on (in fact, I click on the green block).

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitro Rak, 2016-05-31
@Esforal

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.

M
Maxim Fedorov, 2016-05-31
@qonand

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
        // выводим его в ранее заготовленную всплывашку
        // и отображаем ее
    }
});

M
Maxim Timofeev, 2016-05-31
@webinar

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 question

Ask a Question

731 491 924 answers to any question