flex, AdvancedDataGrid, custom itemrenderer
Date : March 29 2020, 07:55 AM
seems to work fine I've had a similar issue in the past when using HierarchicalData. The way I got around it was to use an AdvancedDataGridRendererProvider. Here's some sample code: <mx:AdvancedDataGrid width="100%" height="100%"
id="topAccountsGrid"
backgroundColor="#ffffff">
<mx:dataProvider>
<mx:HierarchicalData source="{filteredList}"
childrenField="children" />
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn id="colRank" headerText="Rank" dataField="Rank__c" width="60" />
<mx:AdvancedDataGridColumn id="list_name" headerText="Name" dataField="Name" />
<mx:AdvancedDataGridColumn id="colPrevRank" headerText="Previous Rank" dataField="Previous_Rank__c" />
<mx:AdvancedDataGridColumn id="colType" headerText="Type" dataField="Type" />
<mx:AdvancedDataGridColumn id="colContacts" headerText="# Contacts" dataField="Contacts__c" />
<mx:AdvancedDataGridColumn id="colDeals" headerText="# Deals" dataField="Deals__c" />
</mx:columns>
<mx:rendererProviders>
<mx:AdvancedDataGridRendererProvider column="{colRank}" depth="1" dataField="Rank__c" renderer="AdvancedDataGridRankCRenderer" />
</mx:rendererProviders>
</mx:AdvancedDataGrid>
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
backgroundColor="{SetBackgroundColor(data)}"
paddingLeft="2" paddingRight="2" paddingTop="2"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
height="22">
<fx:Script>
<![CDATA[
[Bindable] private var bgColor:uint = 0xD6E5FF;
private function SetBackgroundColor(obj:Object):uint
{
var returnColor:uint = 0xFF5050;
if (obj["Rank__c"] != null)
{
switch (obj["Rank__c"].toString().toUpperCase())
{
case "0":
returnColor = 0xFF5050;
break;
case "50":
returnColor = 0xFFFF99;
break;
case "100":
returnColor = 0x66FF66;
break;
default:
returnColor = 0xFF5050;
break;
}
}
return returnColor;
}
override public function set data(value:Object):void
{
super.data = value;
rankLabel.text = value["Rank__c"].toString();
validateDisplayList();
}
]]>
</fx:Script>
<mx:Label id="rankLabel" />
</mx:HBox>
|
ItemRenderer shows through ItemEditor on AdvancedDataGrid
Date : March 29 2020, 07:55 AM
like below fixes the issue The space between the dateInput and the icon is normally transparent. I'm not sure why mx:DataGrid hides the rendered text and the mx:AdvancedDataGrid doesn't. Anyway, there's an easy solution to your problem. Just paint the itemEditors background in the color you like. The following should work. <mx:itemEditor>
<fx:Component>
<mx:DateField yearNavigationEnabled="true" formatString="DD/MM/YY">
<fx:Script>
<![CDATA[
protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
graphics.beginFill(0xFFFFFF); // white
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
super.updateDisplayList(unscaledWidth, unscaledHeight);
}
]]>
</fx:Script>
</mx:DateField>
</fx:Component>
</mx:itemEditor>
|
AdvancedDataGrid ItemRenderer Ignored w/HierarchicalData
Date : March 29 2020, 07:55 AM
seems to work fine You need to set the groupItemRenderer which is used to render the treeColumn (the column that displays the icons, which per default is the first column).
|
Expand and Collapse in treecolumn in advancedgrid in Flex
Date : March 29 2020, 07:55 AM
should help you out you can expand/collapse a specific item simply giving this statement to your adg: adg.expandItem(<your_item>, !adg.isItemOpen(<your_item>))
|
Flex itemrenderer, inline or using itemrenderer tag?
Date : March 29 2020, 07:55 AM
|