Kendo UI目前最新提供KendoUI for jQuery、KendoUI for Angular、KendoUI Support for React和KendoUI Support for Vue四個控件。Kendo UI for jQuery是創(chuàng)建現(xiàn)代Web應(yīng)用程序的完整UI庫。

Rows
Grid使您可以通過使用數(shù)據(jù)項的ID、添加自定義行、使用行模板以及禁用懸停效果來處理其行的外觀。
通過ID獲取行
要通過數(shù)據(jù)項的ID在網(wǎng)格中獲取表行:
1. 確保在網(wǎng)格數(shù)據(jù)源的模型配置中定義了ID字段。
2. 連續(xù)檢索行模型、模型UID和網(wǎng)格表行。
var rowModel =gridObject.dataSource.get(10249); // get method of the Kendo UI dataSourceobject
var modelUID = rowModel.get(“uid”); // get method of the Kendo UI Model object
var tableRow = $(“[data-uid='” + modelUID + “‘]”); // the data-uid attribute is applied to the desired table rowelement. This UID is rendered by the Grid automatically.
添加自定義行
當(dāng)數(shù)據(jù)源不返回任何數(shù)據(jù)(例如,由于過濾的結(jié)果)時,您可以手動添加帶有用戶友好消息的表行。
下面的示例演示如何在Grid的dataBound事件處理程序中添加表行。
function onGridDataBound(e) {
if (!e.sender.dataSource.view().length) {
var colspan = e.sender.thead.find(“th:visible”).length,
emptyRow = ‘… no records …’;
e.sender.tbody.parent().width(e.sender.thead.width()).end().html(emptyRow);
}
}
禁用懸停效果
從Kendo UI Q1 2016版本開始,所有Kendo UI主題均具有用于行懸停的樣式。懸停是一種UI狀態(tài),當(dāng)網(wǎng)格處于編輯模式時,它可以在較長的表行上提供更好的可視化效果。
但是,如果您的項目要求避免懸停狀態(tài),請使用以下兩種方法當(dāng)中的一種:
1. 打開Kendo UI theme CSS文件(例如kendo.default.min.css),然后刪除以下CSS規(guī)則。
.k-grid tr:hover {
/* …background styleshere… */
}
2. 使用下面示例中的CSS代碼覆蓋懸停樣式,#f1f1f1值對應(yīng)于.k-alt表行的背景色。要為您要應(yīng)用的Kendo UI主題找到正確的值,請使用瀏覽器的DOM檢查器,或者設(shè)置喜歡的背景色值。
.k-grid tr:not(.k-state-selected):hover {
background: none;
color: inherit;
}
.k-gridtr.k-alt:not(.k-state-selected):hover {
background: #f1f1f1;
}
京ICP備09015132號-996 | 違法和不良信息舉報電話:4006561155
© Copyright 2000-2026 北京哲想軟件有限公司版權(quán)所有 | 地址:北京市海淀區(qū)西三環(huán)北路50號豪柏大廈C2座11層1105室
北京哲想軟件集團旗下網(wǎng)站:哲想軟件 | 哲想動畫