Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the grid header kendo ui?

I'm working with hierarchy grid kendo ui. I want to hide grid header. Currently, I use the code as below, however, only hide text of header.

// kendo ui grid
.TableHtmlAttributes(new { @class = "GridNoHeader" })

// css
.GridNoHeader thead.k-grid-header
{
    height: 0;
    border-bottom-width: 0;
    visibility: hidden;
    overflow: hidden;
}

Please share your experience if you can. Thanks

like image 290
PeaceInMind Avatar asked Jun 11 '14 16:06

PeaceInMind


People also ask

How do I hide and show columns in kendo grid?

Solution. Toggle the visibility of the column by using the built-in methods of the Grid. Within the beforeEdit event handler, show the column by using the showColumn method. When the save event is fired, hide the column by using the hideColumn method.

What is Pageable in kendo grid?

kendo:grid-pageable-messagesThe text messages displayed in pager. Use this option to customize or localize the pager messages.

What is Kendo grid in MVC?

Kendo UI Grid is an easy, more maintainable, and powerful control for displaying data in a tabular format. Kendo provides many options, such as paging, sorting, filtering, grouping, and editing. These features determine the way data is presented and manipulated.


2 Answers

Here is a jQuery way which you can run immediately after the grid has been initialized:

$("#grid .k-grid-header").css('display', 'none');

It hides the whole header, and is slightly better than the css solution because it applies the style directly to the header as an inline style, meaning that the style automatically has higher priority over all other kendo styles.


Regarding your current way, it only hides the text because visibility:hidden will hide the element, but space is still allocated for it. Try with display:none. Furthermore, the k-grid-header class is applied to the div element that contains the whole header, not on thead. Maybe try this:

.GridNoHeader div.k-grid-header
{
    height: 0;
    border-bottom-width: 0;
    display: none;
    overflow: hidden;
}
like image 191
gitsitgo Avatar answered Sep 27 '22 17:09

gitsitgo


To hide grid header, please use the code as below:

.GridNoHeader .k-grid-header
{
    height: 0;
    border-bottom-width: 0;
    display: none;
    overflow: hidden;
}
like image 31
PeaceInMind Avatar answered Sep 27 '22 18:09

PeaceInMind