Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-14-2011, 01:35 PM   PM User | #1
aghering
New to the CF scene

 
Join Date: Dec 2011
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
aghering is an unknown quantity at this point
Question set datagrid rowcolor on specific criteria

Hello,

As a internship assignment i am trying to make a flex application at the moment Im stuck with a part of one of the needs that the application requests. What I am tryin to accomplish is that when a order is set to a specific day of the week, the row needs to get a color defined to that day. Until so far I have managed that flex gets all the information it needs thru php,

Example of the results from the array returned from php:
Code:
[14-Dec-2011 13:00:15] Array
(
 [0] => Zondag
 [1] => Maandag
 [2] => Dinsdag
 [3] => Woensdag
 [4] => Donderdag
 [5] => Vrijdag
 [6] => Zaterdag
)


[14-Dec-2011 13:00:15] Array
(

 [1] => stdClass Object
 (
 [order_id] => 21
 [order_code] => 
 [contact_fk] => 12
 [order_date] => 2011-12-29
 [order_time] => 15:00:00
 [order_taxtotal] => 1.82
 [order_subtotal] => 30.11
 [order_pricetotal] => 31.93
 [order_status] => opgenomen
 [contact_fullname] => a a
 [order_timedate] => 2011-12-29 15:00:00
 [location_place] => 
 [grid_color] => 0x9900
 [order_day] => Donderdag
 )

 [2] => stdClass Object
 (
 [order_id] => 19
 [order_code] => 
 [contact_fk] => 12
 [order_date] => 2011-11-08
 [order_time] => 13:30:00
 [order_taxtotal] => 2.24
 [order_subtotal] => 37.28
 [order_pricetotal] => 39.52
 [order_status] => opgenomen
 [contact_fullname] => a a
 [order_timedate] => 2011-11-08 13:30:00
 [location_place] => 
 [grid_color] => 0xffffff
 [order_day] => Dinsdag
 )
I already have returned to flex the color code, my question is know how to get flex work with it and change the row color for each row when it loads.
This is how my mxml looks like I hope this is possible.

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" creationComplete="initOrders()" backgroundAlpha="0.8">

<mx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.managers.PopUpManager;
			public var caller:index;
			public var criteria:String
		
			public function initOrders():void						// verkrijg records van database
			{ Gateway.call(onOrders, "Orders.getOrders", criteria);	}
			
			public function onOrders(r:Object):void				// vul datagrid met de records verkregen van initBestellingen()
			{	DG_BBQ.dataProvider = r;	}
			
			public function refresh_orders():void					// ververs contact bij wijziging, toevoegen, filteren van contact(en)
			{	DG_BBQ.dataProvider = null;
				Gateway.call(onOrders, "Orders.getOrders", criteria); }
			
			public function AddOrder():void						// Open popupscherm addcontact
			{	var cManageScreen:manage_order = new manage_order();
				cManageScreen.caller = this;
				PopUpManager.addPopUp(cManageScreen, this, true);
				cManageScreen.newOrder();
				PopUpManager.centerPopUp(cManageScreen); }
			
			public function manageOrder():void						// Open popupscherm addcontact
			{	var cManageScreen:manage_order = new manage_order();
				cManageScreen.OrderId = DG_BBQ.selectedItem.order_id
				cManageScreen.caller = this;			
				
				PopUpManager.addPopUp(cManageScreen, this, true);
				cManageScreen.editOrder();
				PopUpManager.centerPopUp(cManageScreen); }
				
			private function openurl(urlString:String):void
			{
				var urlReq:URLRequest = new URLRequest(urlString);
				
				navigateToURL(urlReq, '_blank');
			}
			
			public function Factuur(id:Number):void
			{ openurl("http://localhost/kersttool/facturen/" + id + ".pdf" as String); 	}
			
			public function Werklijst(id:Number):void
			{ openurl("http://localhost/kersttool/werklijsten/" + id + ".pdf" as String); 	}

		]]>
</mx:Script>

<mx:CurrencyFormatter id="euroFormatter" precision="2" 
  currencySymbol="€" decimalSeparatorFrom="."
  decimalSeparatorTo="," useNegativeSign="true" 
  useThousandsSeparator="true"  thousandsSeparatorTo="." alignSymbol="left"/>
        
        
		<mx:Canvas label="overview" width="100%" height="100%">
			<mx:DataGrid id="DG_BBQ" doubleClickEnabled="true" doubleClick="manageOrder()" width="100%" height="100%" top="0" left="0">
				<mx:columns>
					<mx:DataGridColumn headerText="Offerte nummer" dataField="order_code" width=".10"/>
					<mx:DataGridColumn headerText="Contact" dataField="contact_fullname" width=".15"/>
					<mx:DataGridColumn headerText="Leverings Datum" dataField="order_timedate" width=".15"/>
					<mx:DataGridColumn headerText="Leverings Dag" dataField="order_day" width=".15"/>
					<mx:DataGridColumn headerText="Plaats" dataField="location_place" width=".15"/>
					<mx:DataGridColumn headerText="Totaal prijs" dataField="order_pricetotal" width=".08"/>
					<mx:DataGridColumn headerText="Status" dataField="order_status" width=".08"/>
					<mx:DataGridColumn headerText="" dataField="urlInvoice" width=".10">
						<mx:itemRenderer>
                		<mx:Component>
                    		<mx:HBox horizontalAlign="center">
                        		<mx:Image source="../images/pdf.png" autoLoad="true" scaleContent="true" id="Invoice_image" height="20" width="25" click="outerDocument.Factuur(data.order_id)"/>
                        		<mx:Spacer width="1"/>
								<mx:Image source="../images/todo.png" autoLoad="true" scaleContent="true" id="Todo_image" height="17" width="17" click="outerDocument.Werklijst(data.order_id)"/>  
                    		</mx:HBox>                                            
                		</mx:Component>
            			</mx:itemRenderer>
        			</mx:DataGridColumn>
				</mx:columns>
			</mx:DataGrid>
			
			
		</mx:Canvas> 
</mx:Canvas>
aghering is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:39 AM.


Advertisement
Log in to turn off these ads.