我有这段代码......
$(function() {
var scheduler = $("#scheduler").kendoScheduler({
date: new Date("2015/1/1"),
views: [
{
type: "agenda",
eventTemplate: $("#event-template").html()
},
],
dataSource: [
{
id: 1,
start: new Date("2015/1/1 08:00 AM"),
end: new Date("2015/1/1 09:00 AM"),
title: "Test",
atendees: [1]
}
],
resources: [
{
field: "atendees",
dataSource: [
{ value: 1, text: "Jim" },
],
multiple: true
}
]
}).data("kendoScheduler");
$("#scheduler").on("click", ".edit-event",function() {
var dataItem = scheduler.occurrenceByUid($(this).data("uid"));
scheduler.editEvent(dataItem);
});
});
工作正常,但我正在转向MVVM方法,任何人都可以帮助我获取我的新MVVM代码,以接受我的议程视图的模板。我的代码是
<script id="event-template" type="text/x-kendo-template">
<div class="edit-event" data-uid="#=uid#">
<div><b>Job</b>: #: title #</div>
<div>
<b>Staff:</b>
# for (var i = 0; i < resources.length; i++) { #
#: resources[i].text #
# } #
</div>
</div>
</script>
<div id="topper">
<div class="demo-section k-header wide">
<div>
<div data-role="scheduler" data-views="['agenda','month']" data-bind="source: tasks, visible: isVisible, events: { save: onSave }" data-template="event-template"></div>
</div>
</div>
</div>
哪个不起作用 - 不会崩溃,它只是不加载模板我也知道这种方法可能会将模板用于所有视图而不仅仅是议程。任何帮助都将非常感激。
答案 0 :(得分:0)
要在MVVM中实现相同的行为,您应该将视图定义为&#34; data-views&#34;中的对象。选项:
void wait()
{
std::unique_lock<std::mutex> lock(m_stateCompletedMutex);
while (m_state != STATE_COMPLETED)
{
m_waitCondition.wait(lock);
// Use this an example, it could be any code, executed in the waiting thread
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
}
}