gpt4 book ai didi

html - 使用 HTML Table 作为数据源将数据绑定(bind)到 Kendo UI 模板

转载 作者:行者123 更新时间:2023-11-27 22:29:07 28 4
gpt4 key购买 nike

我创建了一个服务,该服务将根据请求参数返回一组 HTML 表格。目前,我将数据(HTML 页面)作为字符串返回。示例输出如下:

<!DOCTYPE html>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>Person</h1>
<table name="name">
<thead>
<tr>
<th data-field="propertyID"> Property ID</th>
<th data-field="property"> Property</th>
<th data-field="valueID"> Value ID</th>
<th data-field="value"> Value</th>
</tr>
</thead>
<tr>
<td>http://topbraid.org/examples/kennedys#name</td>
<td>Name</td>
<td>Alfred Tucker</td>
<td>Alfred Tucker</td>
</tr>
</table>
<table name="firstName">
<thead>
<tr>
<th data-field="propertyID"> Property ID</th>
<th data-field="property"> Property</th>
<th data-field="valueID"> Value ID</th>
<th data-field="value"> Value</th>
</tr>
</thead>
<tr>
<td>http://topbraid.org/examples/kennedys#firstName</td>
<td>First Name</td>
<td>Alfred</td>
<td>Alfred</td>
</tr>
</table>
<table name="lastName">
<thead>
<tr>
<th data-field="propertyID"> Property ID</th>
<th data-field="property"> Property</th>
<th data-field="valueID"> Value ID</th>
<th data-field="value"> Value</th>
</tr>
</thead>
<tr>
<td>http://topbraid.org/examples/kennedys#lastName</td>
<td>Last Name</td>
<td>Tucker</td>
<td>Tucker</td>
</tr>
</table>
<table name="gender">
<thead>
<tr>
<th data-field="propertyID"> Property ID</th>
<th data-field="property"> Property</th>
<th data-field="valueID"> Value ID</th>
<th data-field="value"> Value</th>
</tr>
</thead>
<tr>
<td>http://topbraid.org/examples/kennedys#gender</td>
<td>Gender</td>
<td>http://topbraid.org/examples/kennedys#male</td>
<td>male</td>
</tr>
</table>
<table name="birthYear">
<thead>
<tr>
<th data-field="propertyID"> Property ID</th>
<th data-field="property"> Property</th>
<th data-field="valueID"> Value ID</th>
<th data-field="value"> Value</th>
</tr>
</thead>
<tr>
<td>http://topbraid.org/examples/kennedys#birthYear</td>
<td>Birth Year</td>
<td>1967</td>
<td>1967</td>
</tr>
</table>
<table name="spouse">
<thead>
<tr>
<th data-field="propertyID"> Property ID</th>
<th data-field="property"> Property</th>
<th data-field="valueID"> Value ID</th>
<th data-field="value"> Value</th>
</tr>
</thead>
<tr>
<td>http://topbraid.org/examples/kennedys#spouse</td>
<td>Spouce</td>
<td>http://topbraid.org/examples/kennedys#KymSmith</td>
<td>Kym Smith</td>
</tr>
</table>
<table name="type">
<thead>
<tr>
<th data-field="propertyID"> Property ID</th>
<th data-field="property"> Property</th>
<th data-field="valueID"> Value ID</th>
<th data-field="value"> Value</th>
</tr>
</thead>
<tr>
<td>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</td>
<td>Type</td>
<td>http://topbraid.org/examples/kennedys#Person</td>
<td>Person</td>
</tr>
</table>
</body>
</html>

现在我得到了 HTML 字符串,我想以某种方式将每个表绑定(bind)到 Kendo UI 中的网格。如何才能做到这一点?如果不是,执行此操作的正确方法是什么?

最佳答案

我不确定这是否正是您想要的,但您可以将该 HTML 注入(inject)您的页面(我的示例使用 jQuery)

<div id="contentArea"></div>

$("#contentArea").html(serviceResult);

然后把所有的 table 变成剑道格:

$("#contentArea table").kendoGrid({});

关于html - 使用 HTML Table 作为数据源将数据绑定(bind)到 Kendo UI 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19642967/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com