我有类似this完整日历的内容,你可以看到你可以创建事件写入输入并点击按钮。
而不是我有一个选择我想要创建具有选定值的事件,是否有可能?
HTML:
<select id="lstRegion" class="form-control select2 select2-accessible agenda_space" aria-hidden="true"></select>
<a href="javascript:;" id="event_add" class="btn green"> Add Event </a> </div>
<div id="event_box" class="margin-bottom-10"></div>
JS:
//load region dropdown
$("#lstRegion")
.getJSONCatalog({
onSuccess: function (response) {
console.log(response);
},
url: '/Agenda/GetRegion',
valueProperty: "ID",
textProperty: "valor"
});
//Event logic
var initDrag = function (el) {
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
// it doesn't need to have a start or end
var eventObject = {
title: $.trim(el.text()) // use the element's text as the event title
};
// store the Event Object in the DOM element so we can get to it later
el.data('eventObject', eventObject);
// make the event draggable using jQuery UI
el.draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0 // original position after the drag
});
};
var addEvent = function (title) {
title = title.length === 0 ? "Untitled Event" : title;
var html = $('<div class="external-event label label-default">' + title + '</div>');
jQuery('#event_box').append(html);
initDrag(html);
};
$('#external-events div.external-event').each(function () {
initDrag($(this));
});
$('#event_add').unbind('click').click(function () {
var title = $('#event_title').val();
addEvent(title);
});
答案 0 :(得分:1)
如果您有以下代码:
var edges = new THREE.LineSegments(new THREE.EdgesGeometry(child.geometry), new THREE.LineBasicMaterial( {color: 0x000000}) );
您将要使用:
<select id="lstRegion" class="form-control select2 select2-accessible agenda_space" aria-hidden="true">
<option>Appointment</option>
<option>All Day Event</option>
<option>Meeting</option>
</select>
这将从$('#event_add').unbind('click').click(function () {
var title = $('#lstRegion option:selected').html();
addEvent(title);
});
中选择当前选中的选项,然后阅读<select>
的{{1}}。