Hari, 
  Thanks...I'll give this a shot. So my question is,
why do I have to write a matching AS class to match my
POJO? When I populate my Datagrid from the remote
object (arraylist of POJOs), I din't have to write any
AS classes.

--- "Doodi, Hari - BLS CTR" <[EMAIL PROTECTED]> wrote:

> Hi,
>       First couple of questions - did you register your
> POJO with AS class
> using Object.registerClass( ) method? 
>       What is the constructor method of you Pojo ?
> After both of above are in place(implemented) then
> you can create new object
> of your POJO type and assign your newly returned
> object to it and then add
> this new object to your datagrid using
> myDataGrid.addItem( );
> 
> This is what I did.....
> AS class looks like
> class classes.MyPojo
> {
>     public var myArray:Array;
>     private static var registered:Boolean =
> Object.registerClass("full path
> of you java class goes here", classes. MyPojo);     
>   
> }
>  In my MXML.... you can ignore statements which sets
> initial attribute
> values 
> function addRow()
>       {
>               var oNewItem:Object = new MyPojo ();  
>         oNewItem.adj_num = "12 ";                
>         oNewItem.adj_type = " ";
>         oNewItem.adj_category = " ";
>         oNewItem.adj_amt_terms_desc = " Doodi";
>         oNewItem.adj_reporter_applied_flag = "N";
>         oNewItem.adj_sign = "Additive";
>         oNewItem.adj_factor = " ";
>         oNewItem.adj_order_applied = "12";
> 
>               myDataGrid.addItem(oNewItem);
>                               
>               focusNewRow();
>               doLater(this,"focusNewRow");
>       }
> Thanks!
> Hari
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On
> Behalf Of suzy lawson
> Sent: Friday, May 27, 2005 10:22 AM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] Converting Java POJO to
> Actionscript Errors
> 
> Hari-
>   THanks for your response. I tried that but I got a
> compilation error that "there is no method with the
> name MyPojo". I suppose that means I have to
> manually
> write the underlying ActionScript class for my Java
> POJO?
> 
> That just seems like a really bad implementation
> design b/c if MyPojo Java class changes, then I have
> to manually change my ActionScript class. urr...what
> am I missing?! 
> 
> --- "Doodi, Hari - BLS CTR" <[EMAIL PROTECTED]> wrote:
> > Try this.....
> > 
> > <mx:script...>
> > var newObj:Object = new MyPojo(); // constructor
> of
> > your POJO
> > function addToGrid() {
> >   newObj = remoteObj.getNewJob();  
> >   myDataGrid.addItem(newObj); 
> > }
> > </mx:script>
> > 
> > Thanks!
> > Hari
> > 
> > -----Original Message-----
> > From: flexcoders@yahoogroups.com
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Kevin Ewok
> > Sent: Friday, May 27, 2005 9:46 AM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Converting Java POJO to
> > Actionscript Errors
> > 
> > Gang-
> >   I'm a newbie and all the flexdocs on MM's site
> > couldn't give me a
> > concrete answer. I have a datagrid that is
> populated
> > from an ArrayList
> > of POJO's (using the remote object). That works
> > fine. 
> > 
> > I then have another method that is called 30
> seconds
> > later then
> > returns a single POJO (of the same type from the
> > POJOs returned in the
> > first method). I then try to add it to my datagrid
> > using the
> > myDatagrid.addItem(newObj), but I get the below
> > debug error.
> > 
> > Warning: Reference to undeclared variable,
> > '_global.com.MyPojo'
> >     at mx_utils_ClassUtil::findClass()
> > Warning: valueOf is not a function
> >     at mx_utils_ClassUtil::getFlexClass() 
> > 
> > Is there a special way I need to declare 'newObj'
> > (which I pass into
> > the datagrid.addItem() method), or do I have to
> > explicity write the
> > AS-equilavent class of my Java POJO class?  
> > 
> > I would think Flex could convert this class for
> me,
> > but I'm obviously
> > missing an important step to add it to the
> > datagrid/dataprovider.
> > Thanks in advance for your help.
> > 
> > <mx:script...>
> > var newObj:Object;
> > function addToGrid() {
> >   newObj = remoteObj.getNewJob();  
> >   myDataGrid.addItem(newObj); 
> > }
> > </mx:script>
> > 
> > <mx:DataGrid id="myDataGrid"
> > dataProvider="{remoteObj.getAll.result}">
> > ...
> > 
> > 
> > 
> > 
> >  
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> > 
> 
> 
>               
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Small Business - Try our new Resources site
> http://smallbusiness.yahoo.com/resources/
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 



                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to