No announcement yet.
  • Filter
  • Time
Clear All
new posts

  • Setting the TreeGrid cell style dynamically

    We are using a Tree control in IE11. There is a lot if user interaction so we rely heavily on JavaScript. Users are allowed to insert, delete and change the data. The final Tree must follow strict rules. While the user edits the Tree, we provide instant feedback by changing the background color of the cells in question. The same cell may be violating multiple rules, so the rules are prioritized.

    We are evaluating the TreeGrid. How can we change the background color of a cell and reset it? Is there a method/property we missed? The getCellCSSText can be used to set the background color on a redraw, but would mean the entire tree would have to be redrawn and verified for each user change.

  • #2
    See refreshCell() and refreshRow().

    Note there's also a built-in subsystem for showing pending edits in a different style - see editPendingBaaeStyle.


    • #3
      The getCellCSSText and refreshCellStyle appear to only temporarily change the style. If the row if hidden by being a leaf on a collapsed row, when expanded again, the set style is no longer applied. Is there a way to make the change stick until it is programmatically reset? If not, then a two dimension array must be kept for reapplying the styles.


      • #4
        You do need to make sure getCellCSSText() continues to return whatever CSS you want to apply after you call refreshCell(), as many actions cause cells to be redrawn (such as drag resizing columns).