Introduction
The kendo tile layout widget is a two-dimensional CSS grid used to display the content in tiles. It has a feature like reordering and resizing. The user can switch the object between tiles just by dragging and dropping and resizing the tiles just by enabling reordering and resizing properties respectively.
Kendo UI Tile Layout
KendoTileLayout.html
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.1.224/styles/kendo.default-v2.min.css" />
- <script src="https://kendo.cdn.telerik.com/2021.1.224/js/jquery.min.js"></script>
- <script src="https://kendo.cdn.telerik.com/2021.1.224/js/kendo.all.min.js"></script>
- </head>
- <body>
- <div id="tilelayout"></div>
- <script id="tile1" type="text/x-kendo-template">
- <span class="k-card" />
- </script>
- <script id="tile2" type="text/x-kendo-template">
- <span class="k-card" />
- </script>
- <script id="tile3" type="text/x-kendo-template">
- <span class="k-card" />
- </script>
- <script id="tile4" type="text/x-kendo-template">
- <span class="k-card" />
- </script>
- <script>
- $("#tilelayout").kendoTileLayout({
- containers: [{
- colSpan: 1,
- rowSpan: 1,
- header: {
- text: "Tile 1"
- },
- bodyTemplate: kendo.template($("#tile1").html())
-
- }, {
- colSpan: 1,
- rowSpan: 1,
- header: {
- text: "Tile 2"
- },
- bodyTemplate: kendo.template($("#tile2").html())
- }, {
- colSpan: 1,
- rowSpan: 1,
- header: {
- text: "Tile 3"
- },
- bodyTemplate: kendo.template($("#tile3").html())
- }, {
- colSpan: 1,
- rowSpan: 1,
- header: {
- text: "Tile 4"
- },
- bodyTemplate: kendo.template($("#tile4").html())
- }],
- columns: 2,
- height:700,
- columnsWidth: 285,
- rowsHeight: 285,
- reorderable: true,
- });
- </script>
- <style>
- .k-card {
- width: 250px;
- height: 250px;
- }
- </style>
- </body>
- </html>
The <div> tag is used to initialize the TileLayout. The container is used to define the tiles. The colSpan and rowSpan is used to define the position of tiles inside the container.
reorderable: true, this statement will enable the reordering feature in tile layout widget.
Summary
We have seen how to implement the Kendo TileLayout widget using jQuery, and the reordering feature to drag and drop the objects between the tiles.