Pivot:Parent level color

Hi Team,
Please find below sample code here i have implemented color at parent level but my requirement is Parent 1 should different color and parent 2 contain different
-P1 red
-P2 Blue
-P3 Yellow

http://webix.com/snippet/5b0f903d

kindly reply

You need to add a complex checkout in your cssFormat. Something like

var cssFormat = function(value,rowData){  
  if(rowData.$count){            // whether it's a branch    
    if (rowData.name == "A name")
        return "parent_cell_1";
    else if (rowData.name == "Another name")
        return "parent_cell_2"; // and so on
  }
  return "child_cell";
};

But here its look like name are static but in my case name always dynamic

template allows to find out the index of a row and return any html for styling the content of the cell:

columns[i].template = function(obj, common, value, column, index){
   if (obj.$count){ 
      return " ... ";
   }
}

But only cssFormat for Pivot columns (and $css in data items, in case of the ui.datatable/list) affects the entire cell (with side paddings) during the initialization. rowData contains the full data item, so it is possible to check any parameter of aggregated data.