原創(chuàng)|使用教程|編輯:龔雪|2020-04-03 09:33:26.663|閱讀 218 次
概述:本文主要為大家介紹鎖定(凍結(jié))列使您可以在用戶水平滾動網(wǎng)格時始終顯示特定列。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Kendo UI for jQuery R1 2020 SP1試用版下載
Kendo UI目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四個控件。Kendo UI for jQuery是創(chuàng)建現(xiàn)代Web應(yīng)用程序的最完整UI庫。
鎖定(凍結(jié))列使您可以在用戶水平滾動網(wǎng)格時始終顯示特定列。
有關(guān)可運行的示例,可參閱有關(guān)在Grid中實現(xiàn)鎖定列的演示。
<!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" href="styles/kendo.common.min.css" /> <link rel="stylesheet" href="styles/kendo.default.min.css" /> <link rel="stylesheet" href="styles/kendo.default.mobile.min.css" /> <script src="js/jquery.min.js"></script> <script src="js/kendo.all.min.js"></script> </head> <body> <div id="example"> <div id="grid"></div> <script> $(document).ready(function() { $("#grid").kendoGrid({ dataSource: { type: "odata", transport: { read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders" }, schema: { model: { fields: { OrderID: { type: "number" }, ShipCountry: { type: "string" }, ShipName: { type: "string" }, ShipCity: { type: "string" }, ShipAddress: { type: "string" } } } }, pageSize: 30 }, height: 540, sortable: true, reorderable: true, groupable: true, resizable: true, filterable: true, columnMenu: true, pageable: true, columns: [ { field: "OrderID", title: "Order ID", locked: true, lockable: false, width: 150 }, { field: "ShipCountry", title: "Ship Country", width: 300 }, { field: "ShipCity", title: "Ship City", width: 300 },{ field: "ShipName", title: "Ship Name", locked: true, width: 300 }, { field: "ShipAddress", lockable: false, width: 400 } ] }); }); </script> </div> </body> </html>
為了使該功能正常運行,必須提供以下配置設(shè)置。 它們確保至少一個非鎖定列始終可見,并且可以水平滾動非鎖定列。 如果預(yù)期的水平空間不足,則不會出現(xiàn)水平滾動條。
注意:
鎖定的列無法觸摸滾動,因為它們被封裝在一個具有溢出:隱藏樣式的容器中。 要解決臺式機設(shè)備上的此限制,請使用mousewheel事件。 但是,觸摸設(shè)備不存在任何解決方法。
鎖定列依賴于同步網(wǎng)格的凍結(jié)和非凍結(jié)部分的行高,某些瀏覽器(例如Internet Explorer 9和Firefox)要求以像素為單位設(shè)置行高樣式。 否則,由于子像素問題,同步可能無法正常工作。
div.k-grid td { line-height: 18px; }
當(dāng)您實現(xiàn)自定義代碼并依靠選擇器或以Grid表為目標時,Grid為其鎖定和可滾動部分創(chuàng)建單獨的表。 鎖定列位于.k-grid-content-locked元素內(nèi),而可滾動內(nèi)容位于.k-grid-content元素內(nèi)。
掃描關(guān)注慧聚IT微信公眾號,及時獲取最新動態(tài)及最新資訊
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都網(wǎng)