row custom background color disappears on expand/collapse of treelist

2 posts, 0 answers
  1. Labhesh
    Labhesh avatar
    23 posts
    Member since:
    Sep 2015

    Posted 16 Sep 2015 Link to this post

    Hi, 

    I am  using the following method to modify row background colors. 

    Basically I want all parents to have one color while their children to have another color.

     

    Here's what I am doing:

    However, on expanding the treelist, it goes back to the original color (i.e. alternating white and greys)..What do I need to fix (or some other way) to accomplish what I am trying? 

     

    function onDataBound(e){
        console.log("data bound event called");
        var rows = e.sender.tbody.children();
        for (var j=0; j<rows.length;j++){
            var row = $(rows[j]);
            var dataItem = e.sender.dataItem(row);
            var stratName = dataItem.get("strategyName");
            if (stratName.indexOf("parent") != -1 ) {
                row.css({"background-color": "#fda"});
            }
            else{
                row.css({"background-color": "#ced"});
            }
     
        }
     
    }// end of onDataBound

     

    Thanks a lot, 

    Labhesh

  2. Labhesh
    Labhesh avatar
    23 posts
    Member since:
    Sep 2015

    Posted 17 Sep 2015 in reply to Labhesh Link to this post

    So this does it for me in css:

     

    .k-treelist .k-alt{
        background-color:white;
    }
    .k-treelist{
        background-color:white;
    }
    .k-treelist-group.ng-scope {
        background-color: #cccccc;
    }

  3. Kendo UI is VS 2017 Ready
Back to Top