所以在后端我使用PHP,这是字符串的格式:
$temp['photos'] = html_entity_decode( $HTMLformatedImg );
作为回应,它的格式很好:
"photos":"<img src='url/test1.jpg'><img src='url/test2.png'>"
当我尝试使用以下方式向用户显示它时:
dataSourceDeals = new kendo.data.DataSource({
//serverPaging: true,
serverSorting: true,
transport: {
read: {
url: crudServiceBaseUrlDeals + "read&businessId={/literal}{$details.id}{literal}",
dataType: "jsonp"
},
update: {
url: crudServiceBaseUrlDeals + "update&businessId={/literal}{$details.id}{literal}",
dataType: "jsonp"
},
destroy: {
url: crudServiceBaseUrlDeals + "destroy&businessId={/literal}{$details.id}{literal}",
dataType: "jsonp"
},
create: {
url: crudServiceBaseUrlDeals + "create&businessId={/literal}{$details.id}{literal}",
dataType: "jsonp"
},
},
batch: false,
pageSize: 10,
schema: {
total: "total",
data: "data",
model: {
id: 'id',
fields: {
id: { type: "number", editable: false },
dealName: { type: "string" },
photos: { type: "string" },
description: { type: "string" },
active: { type: "string" }
}
}
}
});
结果我得到了显示的文本。当我尝试检查该文本时,我得到了这个
<img src='url/test1.jpg'><img src='url/test2.png'>
而且我不确定发生了什么以及为什么。
我正在使用最新版本的剑道 UI。
编辑
$("#deals").kendoGrid({
dataSource: dataSourceDeals,
pageable: true,
resizable: true,
toolbar: [{ text:"Add Deal", className: "gridAddDeal"}, { text:"Edit Selected", className: "gridEditDeal"}, { text:"Delete Selected", className: "gridDeleteDeal"}],
height: 400,
sortable: 'true',
selectable: true,
columns: [
{ field: "id", title: "ID", width: "40px" },
{ field: "dealName", title: "Coupon Name", width: "100px" },
{ field: "photos", title: "Photos", width: "100px" },
{ field: "description", title: "Description", width: "100px" },
{ field: "active", title: "Active", width: "70px" }
]
});