【发布时间】:2016-04-21 09:54:52
【问题描述】:
我设置了一个调度程序(时间线视图),它可以生成一个看起来像所附图像的界面。
[![scheduler_screenshot][1]][1]
调度程序代码的资源部分如下所示:
, resources: [
{
field: "loca_ky"
, name: "Locations"
, dataSource: [
{text:"CHAR above entrance doors", value:1},
{text:"BELLIARD Passerelle", value:2},
{text:"BERL Schuman", value:3}
]
, title: "Location"
}
]
我希望用户能够找到有关位置的更多信息(例如“入口门上方的 CHAR”等),因此希望在文本周围提供一个超链接,或者添加一个带有超链接的图标。
我该怎么做?
对答案的回应
嗨,杰伊什
回复。方法1.脚本失败后添加新函数,因为我已经在使用调度程序的“数据绑定”节点作为函数。见以下代码:
, dataBound: function(e) {
// hide the times row from the date/time header:
var view = this.view();
view.datesHeader.find("tr:last").prev().hide();
view.timesHeader.find("tr:last").prev().hide();
// Switch the colour of the reservation depending on stat_ky
$('div.k-event').removeClass('special-event'); // Remove the widget default colour.
$('div.k-event').addClass('eventRequested'); // Add back the eventRequested colour, which we use for every stage up to BOOKED.
e.sender._data.forEach(function(eventDetails) {
if (eventDetails['stat_ky'] == 5) {
// Switch the colour to eventAccepted for BOOKED requests (stat_ky=5).
$('div.k-event[data-uid="'+eventDetails['uid']+'"]').addClass('eventAccepted');
}
});
}
我应该把你的代码放在这个函数中吗?
对答案的回应,2
嗨,杰伊什
是的,这确实很好用!
最后一个障碍。在您的示例中,这里是资源的数据源:
dataSource: [
{ text: "Meeting Room 101", value: 1, color: "#6eb3fa" },
{ text: "Meeting Room 201", value: 2, color: "#f58a8a" }
],
你可以像这样使用 element.html() 获得“文本”:
element.html("<a href='http://google.com/" + element.html() + "'>" + element.html() + "</a>");
如何引用资源的“价值”?
【问题讨论】:
-
是的,请将给定函数的代码放入您现有的数据绑定方法/函数中。
-
请看原帖的最新回复