This is a migrated thread and some comments may be shown as answers.

Setting the Text of the header in a client template column

2 Answers 697 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reid
Top achievements
Rank 2
Reid asked on 28 Feb 2019, 10:45 PM

I am having trouble with the header text of a column where there is a client template in place.  I want to not show any text in that column.  But if I set .Title("") or .Title(string.Empty) it shows the column name anyway.

Here is the markup for that column :

columns.Bound(a => a.ProductBuyLink).ClientTemplate(
"<a href='" + "#= ProductBuyLink #" + "' target=blank>" + "<img title='Buy Now' alt='Buy Now' height=25 src='../../images/shoppingcart_24.png'/></a>").Width(63).Title("").Sortable(false).Locked(true);

 

 

I have searched and found many solutions that do not work. 
https://www.telerik.com/forums/get-column-header-title
https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.headertemplate


Like this does not work :
$("#grid thead").find("[data-field='ProductBuyLink'] .k-link").html("");

If I use the code in the line above for another column not using a Client Template it works.  So the issue has to do with columns with a client template defined.

Please advise.

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Adam
Top achievements
Rank 1
answered on 01 Mar 2019, 04:18 AM

Hello Reid,

The trick is to use a non-breaking space. Give this a try:

columns.Bound(c => c.Name).ClientTemplate("<span>Test</span>").Title("&nbsp;");
0
Reid
Top achievements
Rank 2
answered on 01 Mar 2019, 12:37 PM
Thank you Adam, that did it!
Tags
Grid
Asked by
Reid
Top achievements
Rank 2
Answers by
Adam
Top achievements
Rank 1
Reid
Top achievements
Rank 2
Share this question
or