have you defined these engineer class as an instance variable ???? Please try to post your code so that we can help you out
Thank you for the swift reply...,
I actually have three java classes Unit , Engineer and UnitretrievalRemote....
Unit contains engineer and also UnitRetrievalRemote has methods to retrieve unit which inturn should return engineer...,However i hav actionscript classes for both engineer and unit and mapped it apporopriately using the remotetag...and also my remote object is defined with a destination...
The below code is my Actionscripting code included in mxml:
import UnitScript.Engineer;//These are my Action Scripting Classes
public var unitIds:ArrayCollection;//I'm passing an array from java end
that retrieves the unitId's from the db using hibernate...
public var index:int;
public var unit:Unit;
protected function initData():void
//This is the remoteobject call using blazeds to load the method during application start from java..
private function setUnitIds(event:ResultEvent):void
unitIds = ArrayCollection(event.result);
private function setUnit(event:ResultEvent):void
unit = Unit(event.result);
//mx.controls.Alert.show( "Compling" );
//mx.controls.Alert.show( "Engineer Method" +unit.engineerId);
//mx.controls.Alert.show( " Engineer=="+unit.engineer) ;
unitIDText.text = String( unit.unitId );
customerName.text = unit.name;//displaying the contents fetched from the backend in the panel...
private function setEngineer(event:ResultEvent):void
unit.engineer = Engineer(event.result);
unit = Unit(event.result);
eng_id.text = String(unit.engineer.engineerId);
mx.controls.Alert.show( "Engineer ID Please Show"+unit.engineer);
//This prints a null.
mx.controls.Alert.show( "Direct Engineer Id" +unit.engineer.category);
// This prints a null.
Remote object mapping is as below:
<mx:method name="getUnitIds" result="setUnitIds(event)"
<mx:method name="getUnit" result="setUnit(event)"
R U CALLING getUnit() method of your unit service...I guess this is not there in the code.
getUnit and the getunitIds methods are in the java end.....
public class ApplicationService
private UnitEquipmentMapDAO unitEquipmentMapDAO;
private TaskOrderDAO taskOrderDAO;
private EngineerDAO engineerDAO;
private UnitDAO unitDAO;
private PersonDAO personDAO;
private EquipmentDAO equipmentDAO;
private ClientDAO clientDAO;
private TruckDAO truckDAO;
private UnitAssignmentDAO unitAssignmentDAO;
private OperatorDAO operatorDAO;
public Integer getUnitIds()
List units = unitDAO.findAll(); //finds and returns all the units from the database...
Integer result = new Integer[ units.size() ];
for( int i=0 ; i< units.size(); i++ )
Unit unit =(Unit)units.get( i );
result[ i ] = unit.getUnitId();
public Unit getUnit( Integer id )
Unit unit = unitDAO.findById( id );
This is the Unitretrievalremote class:
public ArrayList getUnitIds()
Integer ids = appService.getUnitIds();
ArrayList result = new ArrayList();
for( int i=0; i< ids.length; i++ )
System.out.println( "Number of units= " + result.size() );
public Unit getUnit( Integer id )
Unit unit = appService.getUnit( id );
The getunitIds call the setunitids() from the actionscript class and also the getunitid calls the setunitid() from the actionscript class thru remote object....
1 person found this helpful
see you cannot get the data required from two methods of backend in a single shot and from single event. Please fire different event types and your single custom event mate. for example
Create a custom event like
public class CustomEvent extends Event
public static var GET_ID:string="id";
public static var GET_UNIT_ID:string="unitid";
public function CustomEvent(type:String, data:ArrayCollection=null, bubbles:Boolean=false, cancelable:Boolean=false):void
super(type, data, bubbles, cancelable);
and your Flex should be able to catch these two types of event types based on the calls to diffrent methods of your service and should get the required data to typecast it into ArrayCollection mate.
Hope this helps,
Thanks a ton...will try this out....
I'm trying to do some datagrid activity using flex this time.....,
I have a java class that gets the data from the database I'm however using hibernate and spring....
The problem arises when im trying to get the data displayed in the datagrid component of the flex application using remote method invocation...
i have an AS class as well that maps my corresponding java class...however im unable to get my data displayed in the datagrid and also im having the list from java mapped into an arraycollection in AS....but when im trying to print the arraycollection variable length it gives me a null.....the dataprovider property when assigned with the arraycollection variable is not rsponding as i dont see any output getting reflected in the grid...please help me out with this issue....thanks in advance....
If there is anyone who could help me out with this...it would be most appreciated
How do i atleast know that my arraylist from java is mapped to my arraycollection var in AS...,
is there a way i can get to see the individual elements of the list in AS...Please help
I have a little misunderstanding about inline itemrenderers, as i mentioned earlier im new to flex please pardon me if this is a silly question..
I have an Advanceddatagrid, i have added a column of checkboxes usint inline itemrendered:
<itemrenderer = mx.controls.CheckBox">
i have the column defined as select i.e....
<AdvancedDatagridColumn id="select" itemrenderer="mx.controls.CheckBox">
i have a series of columns following this above column...i want to be able to select a particular row
upon the selection of the checkbox....i however doubt that im selecting the column("select") and not an individual
Or in better words "Is there a way where i can reference to these checkboxes individually" as im intending to do
some data inserting,deleting and updating activity depending upon the selected checkbox...
However i also intend to open another MXML file that contains only that data that is checked by the checkbox...
I request you experts to help me out with this....
Im trying to do this from 2 days now...., please help me out....
Thanks all in advance..
I tried out what you had suggested....,but iam afraid the problem still persisted until i had to just make the lazy loading attribute of the hbm file
for that particular DAO set to true..
It's perfectly working now....thanks again for all the help...