如何添加 link 到 Kendo TreeList
how to add a link to Kendo TreeList
我有以下代码:
var mdl = @Html.Raw(Json.Encode(Model.FacilityList));
var ds = new kendo.data.TreeListDataSource({
data: mdl,
schema: {
model: {
id: "ClientOrganizationId",
fields: {
parentId: { field: "ParentOrganizationId", nullable: true },
ClientOrganizationId: { field: "ClientOrganizationId", type: "number" },
Name: { field: "Name"},
Street: { field: "Street" },
City: { field: "City" },
State: { field: "State" },
ZipCode: { field: "Zipcode" }
},
expanded: true
}
}});
$("#treelist").kendoTreeList({
dataSource: ds,
selectable: true,
columns: [
{ field: "Name", title: "Organization Name"},
{ field: "Contracted", title: "Contracted"},
{ field: "ClientOrganizationId", title: "Id"},
{ field: "Street", title: "Street"},
{ field: "City", title: "City" },
{ field: "State", title: "State" },
{ field: "ZipCode", title: "ZipCode"}]});
我如何添加另一列包含指向 "Home" 控制器的 "Update" 操作的操作链接,并将 ClientOrganizationId 作为参数传递?
我希望更新操作是这样的
public ActionResult Update(int Id)
{
}
您使用了列模板;基本上是这样的:
{
field: "ClientOrganizationId",
title: "Id link",
template: "<a href='/Home/Update/#= ClientOrganizationId #'>" +
"link me to id: #= ClientOrganizationId # </a>"
},
即在用
写入 id 值时填写调用更新操作所需的任何内容
#= ClientOrganizationId
#
(我不记得 link 语义,所以 href 部分可能非常错误)
我有以下代码:
var mdl = @Html.Raw(Json.Encode(Model.FacilityList));
var ds = new kendo.data.TreeListDataSource({
data: mdl,
schema: {
model: {
id: "ClientOrganizationId",
fields: {
parentId: { field: "ParentOrganizationId", nullable: true },
ClientOrganizationId: { field: "ClientOrganizationId", type: "number" },
Name: { field: "Name"},
Street: { field: "Street" },
City: { field: "City" },
State: { field: "State" },
ZipCode: { field: "Zipcode" }
},
expanded: true
}
}});
$("#treelist").kendoTreeList({
dataSource: ds,
selectable: true,
columns: [
{ field: "Name", title: "Organization Name"},
{ field: "Contracted", title: "Contracted"},
{ field: "ClientOrganizationId", title: "Id"},
{ field: "Street", title: "Street"},
{ field: "City", title: "City" },
{ field: "State", title: "State" },
{ field: "ZipCode", title: "ZipCode"}]});
我如何添加另一列包含指向 "Home" 控制器的 "Update" 操作的操作链接,并将 ClientOrganizationId 作为参数传递?
我希望更新操作是这样的
public ActionResult Update(int Id)
{
}
您使用了列模板;基本上是这样的:
{
field: "ClientOrganizationId",
title: "Id link",
template: "<a href='/Home/Update/#= ClientOrganizationId #'>" +
"link me to id: #= ClientOrganizationId # </a>"
},
即在用
写入 id 值时填写调用更新操作所需的任何内容#= ClientOrganizationId
#
(我不记得 link 语义,所以 href 部分可能非常错误)