Dynamic css for one cell in DataTable - PrimeNG - css

I'm using databale from PrineNG in my angular+typescript project.
I have datatable with some editable cells.
I want to change cell background color in some cases.
I know I can use 'bodyStyleClass'. But I need to take some css class based on whole row (I need to compare two values).
It means background color should be dynamically changed by my method.
How I can do this?

Related

React DataGrid Single Row Customization

Working with a Material UI react data grid for the first time and I need to apply a custom background color to only the first 3 rows, each being a different color. The custom coloring of these rows is static, nothing that's supposed to happen after an event takes place. Is there any way to point to only one row and apply a background color to it from my scss file?
On a slightly related note, how do I extend column separators so they fill the data grid?
Thank you in advance!
use nth-child(1){}
for style the number 1 child.

JavaFX TreeTableView dynamic styling without css

I am new to JavaFX and I don't know how to set cell styles dynamically in a TreeTableView.
For example, I wish to set a cell's background color on the fly based on user input. The user may specify a range (e.g. dark red to light red). I would calculate the appropriate value for a specific cell and then set the background color based on the calculation result.
I am familiar with JTable's approach of writing a cell renderer but JavaFX appears to handle things quite differently.

Devexpress BatchEdit cell style - Simulate input

I'm using DevExpress and I have an ASPxGridView that can be modified by BatchEdit.
This grid only have some cells that can be edited, and even on the same column some cells can be modified and others not (it depends on some conditions and I control that by JS with OnBatchStartEdit)
I want that the user could see quickly which cells are ready for edit and which ones not. I thought about simulating an style like if it were an input with CSS with outline and outline-offset, but outline-offset does not work on IE and without it, it is really ugly.
Another option I thought was with a border + radius, but with radius the background color of the cells outside the radius stays in white, and I don't want that because all the row must have the same color.
Do you have any solution to the issues of the options above or a new way to do what I want?

Different color for Cells in Flex

I have datagrid in which some cells (not entire columns) are editable and others are not(all is predefined).what we want to achieve is that to differentiate editable and uneditable cells applying differnet colors.
How to achive this?
Thanks in advance.
Use an itemRenderer and set style colors inside the itemRenderer. Depending on your complexity you may consider conditionally setting the style of the itemRenderer based on the data.

Formatting AdvancedDataGrid Cells

I have a quick question about rendering the advanceddatagrid cells.
I need to programatically color the cell of the datagrid based on the conditions. Lets say, the stock quotes. If there is an increase from the previous day, I need to have the cell colored in GREEN and in RED, when there is a decrease.
Now, the important part here is, I need to do these things dynamically, which means, when the user enables the comparison/conditions, then the cells are colored. And when the user disables the comparison, then it again goes back to its default behavior.
I know I have to use renderers. But not sure, how to use it for the cells and that too dynamically. Can anyone please explain how to go for it?
Thanks
Item renderers are components used to define the appearance of a component's "items" or subcomponents. In the case of the ADG, the "items" are the individual cells. You can create a completely custom class to function as the renderer (given it implements certain required interfaces) or, in most cases, you extend an existing component. Since the default renderer for ADG cells doesn't support background colors, you have to create or extend a component that does and use that as the renderer. That is the basic premise that these tutorials, linked to in the following question, work from:
Setting background color for datagrid row in Adobe Flex
After creating an itemRenderer that supports a background color, you have two options as to where you can define your "conditions"; inside of the itemRenderer or using the ADG's styleFunction (additionally requiring that your itemRenderer defines a "background" style).
In your case, you could include both today's and yesterday's stock price values in the data sent to each cell and compare the two to determine the color used to draw the background. Again, more on that in the tutorial links provided above. In either the itemRenderer or the styleFunction, you would compare properties on the itemRenderer's/styleFunction's data object (corresponding to the row you're looking at), e.g.:
if(data.today > data.yesterday)
{
// set color or return style
}
else ...
To "toggle" custom cell colors, switch between your custom renderer and the default (colorless) renderer. In other words, set the itemRenderer property to your custom itemRenderer class when you need display the colors and set it to "null" when you want the "default behavior".

Resources