Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example for Responsive Kendo UI grid

I have implemented KendoUI in my WebApp, is there any way of making the grid responsive? Like, showing fewer columns on smaller resolutions!

like image 252
Sabby62 Avatar asked Sep 13 '13 22:09

Sabby62


People also ask

How do I make my Kendo grid responsive?

The responsive features of the Kendo UI Grid for Angular are: Responsive columns—Based on the viewport width, the visibility of the Grid columns toggles. Responsive height—Based on the height setting (for example, "100%" ), the Grid adjusts its size depending on the height of its container.

What is pageSize in kendo grid?

It sets the page size to the total number of records. If a pageSize setting is provided for the data source then this value will be selected initially.

Is Kendo UI and Telerik same?

Telerik UI for PHP is a Kendo UI product flavor which targets the PHP web application developers. It includes PHP classes for configuring all Kendo UI components.


2 Answers

Here's my bootstrap-styled Kendo UI grid BEFORE applying the following styles

Unstyled unresponsive Kendo Grid

And here's what you get afterwards. May not be perfect, or what some will consider 'responsive' enough. But, for my users, this works a treat. Phone isn't our target platform anyways, but, now we can at least see what's in the grid, even if we cannot sort it.. etc.

enter image description here

And here are the styles inspired by @Vel's codepen, from earlier in this thread. His codepen styles are missing a statemetn to hide the colgroup element.. which is integral for this approach. Be sure to put this CSS in your page flow somewhere AFTER the main kendo CSS file

@media screen and (max-width: 800px) {

.k-widget table {
    border: 0;
}

.k-widget table thead, table colgroup {
    display: none;
}

.k-widget table tr {
    margin-bottom: 10px;
    display: block;
    border-bottom: 2px solid #ddd;
    border-radius: 20px;
}
.k-widget table tr td:last-child {
    background-color: #313444;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}
.k-widget table tr td:nth-child(2) {
    background-color: #313444;
    color: #FFF;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    font-weight: bold;
    padding-top:1em;
}

.k-widget table td {
    display: block;
    font-size: 13px;
    border-bottom: 1px dotted #ccc;
}
.k-widget table td:before {
    content: attr(data-label);
    float: left;
    text-transform: uppercase;
    font-weight: bold;
}
}
like image 199
bkwdesign Avatar answered Nov 15 '22 12:11

bkwdesign


There is now a minScreenWidth setting for each column, which hides the column when the browser width is less than the specified. In our application we have set some constants corresponding to the Bootstrap media query breakpoints, so instead of manually specifying the width every time, we use these constants and thus some columns are hidden when you are below e.g. the Bootstrap sm or xs breakpoints.

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.minScreenWidth

like image 25
AsGoodAsItGets Avatar answered Nov 15 '22 11:11

AsGoodAsItGets