0
我正在尝试使用KO绑定的表格。按照本教程中的示例http://knockoutjs.com/examples/grid.html,我已将网格变为此变量。在基因敲除JS网格中创建hrefs
var PagedGridModel = function(items) {
this.items = ko.observableArray(items);
this.gridViewModel = new ko.simpleGrid.viewModel({
data: this.items,
columns: [
{ headerText: "Date Created", rowText: function (response) {
var d = new Date(response.postingDate);
return d.toLocaleDateString();
} },
{ headerText: "Subject", rowText: "subject" },
{ headerText: "Status", rowText: "status" },
{ headerText: "Date Updated", rowText: function (response) {
var d = new Date(response.updationDate);
return d.toLocaleDateString();
} },
{ headerText: "", rowText: function (response) { } }
],
pageSize: 10
});
};
我需要在最后一行文本中写一个函数来为我的页面创建一个超链接。这是我试图用Knockout替换的JSP。
<c:forEach items="${responses}" var="response">
<tr>
<td>${response.postingDate}</td>
<td>${response.subject}</td>
<td>${response.status}</td>
<td>${response.updationDate}</td>
<c:url value="/contact/viewDetails" var="viewDetailsURL">
<c:param name="ticketId" value="${response.ticketID}"/>
</c:url>
<td><a href="${viewDetailsURL}">View Details</a></td>
</tr>
</c:forEach>
如何在最后一个rowText函数中为“View Details”创建一个href?
见http://knockoutjs.com/documentation/attr-binding.html –