Color change to highlight a specific header

1 posts, 0 answers
  1. MO
    MO avatar
    23 posts
    Member since:
    Jul 2012

    Posted 06 Nov 2014 Link to this post

    I'm trying to change the attributes (color, font-weight, whatever) of the header TreeMapItems and the code for RadTreeMap appears to be setting those attributes AFTER where I'm trying to make the changes. I have a single header with "*" in the string, passed from the database as a special item that needs to be highlighted.

    First, I tried to change the styles, style properties, classes, etc. during the onClientItemCreated and those changes are erased by the time the page actually finises oading.I even went as far as to try and straight-up replace text in the innerHTML (which, in the example below is: "<div>ETL 1101*</div>"...

                if (itemText.indexOf("*") >= 0) {
                    var txt = itemElement.firstChild.innerHTML
                    txt = txt.replace("<div>", "<div id='MyTextColor'><span style='color:red'>")
                    txt = txt.replace("</div>", "</span></div>")
                    itemElement.firstChild.innerHTML = txt

    So then I thought "Ah! I'll change it in the pre-rendering", addhandler for treemap.PreRender and iterate through the object looking for the treemapitem.text.contains("*") 

         Protected Sub tmAgencySubmissions_PreRender(sender As Object, e As System.EventArgs)
            Dim tm As RadTreeMap = CType(sender, RadTreeMap)
            For Each i As TreeMapItem In tm.Items
         End Sub

         Protected Sub ContinueLooking(ByRef tmi As TreeMapItem)
            If tmi.Text.Contains("*") Then
                tmi.Color = Color.Red
                For Each i As TreeMapItem In tmi.Items
            End If
         End Sub

    Again, the color change doesn't hold. I realize this is background color (because TreeMapItems don't appear to have a property for font color!!), but I'm trying _anything_ right now.

    Obviously, changing the ClientItemTemplate or modifying the site.css to include a rewrite for "div.RadTreeMap.RadTreeMap_Telerik div.k-tree-map-title" changes ALL of the headers.

    So what am I doing wrong here? Where do I need to make this change for it to ACTUALLY work?


Back to Top