简体   繁体   English

具有外部事件数据的全日历引导程序模式

[英]fullcalendar bootstrap modal with external event data

I'm using full calendar with a asp.net MVC 5 application. 我正在使用带有asp.net MVC 5应用程序的完整日历。

When I click a on a empty space I get a modal view for creating a event. 当我在空白处单击时,会看到用于创建事件的模式视图。 This works perfect. 这完美。

When I click on a event I want to get the event data but also some other data then just the start date end date and description. 当我单击某个事件时,我想要获取事件数据,但也要获取其他一些数据,然后仅获取开始日期,结束日期和说明。

I have the following: 我有以下几点:

eventRender: function (event, element) {
                var id = event.id;
                element.popover({
                    placement: 'top',
                    html: true,
                    content: '<button id="customers" class="btn btn-default" onclick="KlantenModal(' + id + ')">Klant overzicht</button>',
                    animation: true
                });
            }

The function that calls the modal. 调用模态的函数。

function KlantenModal(event) {
        $('#klanten #eventId').val(event);
        $('#klanten').modal('show');
    }

and the bootstrap modal: 和引导模态:

<div class="modal fade" id="klanten" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
    <div class="modal-content">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Klanten</h4>
            </div>
            <div class="modal-body">

               /* here I want some Data eg. names of customers */

                 <input type="hidden" id="eventId" name="eventId" />


            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                <button type="submit" class="btn btn-primary"></button>
            </div>

    </div>
</div>

If i understood you well the only thing you have to do is to add fields to the event like this: 如果我对您的了解很好,那么您唯一要做的就是向事件添加字段,如下所示:

Somewhere in your code populate an array with diferent customers and add that array to the event properties 在代码中的某个位置填充了具有不同客户的数组,并将该数组添加到事件属性中

    var customers = [];
    customers.push("im customer x");
    customers.push("im customer y");
    ...
events:[ 
        {
         'start': 2013-12-30,
         'end': 2013-12-30,
         'allDay': true,
         'customers': customers
        }

and when you click on the event and access the event fields you will get the customers field wich contains your customers for that day. 当您单击事件并访问事件字段时,将获得包含当天客户的客户字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM