grid - 剑道 UI 网格 : is it possible to have more than one grid on the page without element ID collisions?

标签 grid kendo-ui

页面上是否可以有多个 Kendo UI 网格? 编辑:网格必须同时可见。

对于我过去尝试过的一些 jQuery 网格,一页上不可能有多个网格实例,因为网格分配给其子 DOM 元素的 ID 没有以网格 id 为前缀;页面上有多个网格将创建两个或多个具有相同 ID 的 DOM 元素。

最佳答案

是的,我已经在我的项目中实现了这一点,没有出现您提到的任何问题。我在一页中有 3 个网格。

更新:基本小部件元素具有您自己分配的任何 ID。至于子元素,它们不使用ID,而是使用数据属性。我在整个网格中没有看到任何 ID。以下是我的一个网格中表标题的示例:

<thead class="k-reorderable" data-role="reorderable">
<tr>
<th class="k-header" data-title="Service name" data-field="Name" role="columnheader" data-role="sortable">
<a class="k-link" href="#">Service name</a>
</th>
<th class="k-header" data-title="Lasting time" data-field="LastingTime" role="columnheader" data-role="sortable">
<a class="k-link" href="#">Lasting time</a>
</th>
<th class="k-header" data-title="Price" data-field="Price" role="columnheader" data-role="sortable">
<a class="k-link" href="#">Price</a>
</th>
</tr>
</thead>

数据行使用 UID 来区分自己,这是另一个示例:

<tr class="k-alt" role="row" data-uid="f2cd4f59-8492-4616-8fc6-5d65ec466437">
<td role="gridcell">Test</td>
<td role="gridcell">01:00:00</td>
<td role="gridcell">500</td>
</tr>

我建议您查看 http://demos.kendoui.com/ 上的示例并检查网格生成的 html 以获取更多详细信息。

我认为您不应该直接通过 DOM 访问特定的子元素。我建议坚持使用小部件 API,这就是它存在的原因。

希望这有帮助!

关于grid - 剑道 UI 网格 : is it possible to have more than one grid on the page without element ID collisions?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13869535/

相关文章:

kendo-ui - 不支持 Kendo ui odata 请求回调

javascript - 是否可以在 Kendo UI 线性仪表上仅显示最大/最小值?

python - 在python中将随机整数添加到网格的外部单元格

grid - 苏西网格: position element by location not working

css 转换不适用于 css 网格,元素定位问题

jquery - 我可以将整数数组附加到 Json 对象并传递给 Controller ​​方法吗?

jquery - KendoComboBox MVC 查找值,如果存在则选择它,如果不存在则选择其他值

asp.net-mvc - 将静态网站从 Azure 存储帐户添加到 Asp.net MVC 应用程序?

javascript - 带剑道调度程序的动态资源

java - 测试确实在本地的 Selenium 网格上运行正常)