Flex: Row based rendering in Datagrid - apache-flex

I need to have custom rendering of each row in my datagrid. It is column based by default. Is there some way to achieve this?
If any one has tried this before or has any idea in this regard, then please share.
Thanks in advance.
Ashine.

If all you want is different colors, there is an alternatingItemColors style in DataGrid's base class ListBase. You can set an array of colors.
The colors to use for the backgrounds of the items in the list. The value is an array of two or more colors. The backgrounds of the list items alternate among the colors in the array.
For DataGrid controls, all items in a row have the same background color, and each row's background color is determined from the array of colors.
What kind of customization are you looking for?

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.

column borders in asp.net table controls

I am new to asp.net and using it to create a form. I have a table control, in which I need to put visible borders only between columns. I dont need the border anywhere else. Is there a way to do this and if yes, how?
thanks in advance
I would assign a css class to your table cells that had definitions for border-left and border-right set to the color and thickness you'd like.
You can do css and set borders colors but easier is just with simple format like in ms word. Tick whole column and go to format -> boders and shading there is everything you need.

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.

Flex - How to find Datagrid Cell Object

I have datagrid in my page and I want to change particular cell background color. I don't want to use itemrenderer. Is there any alternate ?
Here is an example of changing the selection color: Flex Examples
If you want to do more than that, I'm afraid you will have to use an itemRenderer.
You could subclass DataGrid and override the protected drawRowBackground() method or possibly drawColumnBackground(). These are intended to draw the background for an entire row or column but you may be able to get it to draw a special color only for the cell(s) you want.

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