Setting the Text of the header in a client template column

3 posts, 1 answers
  1. Reid
    Reid avatar
    448 posts
    Member since:
    Oct 2008

    Posted 28 Feb 2019 Link to this post

    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. Answer
    Adam
    Adam avatar
    7 posts
    Member since:
    Aug 2018

    Posted 28 Feb 2019 in reply to Reid Link to this post

    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;");
  3. Reid
    Reid avatar
    448 posts
    Member since:
    Oct 2008

    Posted 01 Mar 2019 in reply to Adam Link to this post

    Thank you Adam, that did it!
Back to Top