From: Doug Lowder <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, October 25, 2006 2:45:25 AM
Subject: [flexcoders] Re: remote object help
Hi Ramana,
Try setting your datagrid's dataProvider property to list instead of
loginChkA.list.
<mx:DataGrid id="dg" dataProvider= "{list}"
Another good practice is to use mx.utils.ArrayUtil. toArray() on the
RemoteObject result to ensure you are dealing with an array. If the
getList() method returns a single item, the results will be
interpreted as an Object instead of the expected Array.
Regards,
Doug
--- In [EMAIL PROTECTED] ups.com, "RAMANA" <golamudi_ramana@ ...>
wrote:
>
> hai everybody,
> i am new to flex environment and i am presently working on remote
> object service.
> in this regard i need a help,
> i am trying to retrieve values from sql and output them to
datagrid,
> i am unable to see the values outputed to datagrid
> my sql db contains two columns cname and
email, and i am working
on
> flex 1.5
> here is my mxml,as,java file to solve the above problem.
>
> LoginchkAB.java
>
> import java.sql.*;
> import java.util.ArrayList ;
> public class LoginchkAB{
> Connect q=new Connect();
> public void LoginchkAB()
> {
>
>
> }
> public ArrayList getList()
> {
> ArrayList list = new ArrayList();
> try
> {
> Connection Conn=q.establish_ Connection( );
> Statement s = Conn.createStatemen t();
> ResultSet rs= s.executeQuery( "select cname,email
from
> deepa123456" );
> System.out.println( "ramana") ;
>
> while
(rs.next
> ()) {
> list.add(new ViewuserVO
> (rs.getString( 1),rs.getString( 2)));
> System.out.println( "ramana") ;
> }
>
> s.close();
> Conn.close() ;
> }
> catch(Exception e)
> {
>
System.out.println( "TechRP"+ e);
> }
> return list;
> }
> public static void main(String args[])
> {
> LoginchkAB q=new LoginchkAB() ;
>
> }
> }
>
> ViewuserVO.as file
>
> class ViewuserVO {
> public var cname : String;
> public var email : String;
>
>
> static var registered=Object. registerClass( "ViewuserVO" ,
> ViewuserVO);
> }
>
> UsingRemoteObj1. mxml
>
> <?xml version="1.0" encoding="utf- 8"?>
>
> <mx:Application xmlns:mx="http://www.macromed ia.com/2003/ mxml"
> verticalGap= "10">
> <mx:Button label="Get user List" click="getusers( )"/>
>
>
>
>
> <mx:DataGrid id="dg" dataProvider= "{loginchkA. list}"
width="100%"
> height="100% ">
>
<mx:columns>
> <mx:Array>
> <mx:DataGridColumn columnName=" cname"
> headerText=" cname" />
> <mx:DataGridColumn columnName=" email"
> headerText=" email"/>
> </mx:Array>
> </mx:columns>
> </mx:DataGrid>
> <mx:Script>
> var list;
>
> </mx:Script>
> <mx:Script>
> <![CDATA[
> function getusers()
> {
> loginchkA.getList( );
> }
> ]]>
> </mx:Script>
>
> <mx:RemoteObject id="loginchkA" result="list= event.result"
> source="LoginchkAB" fault="alert
(event.fault. faultstring, 'Error')">
> <mx:method name="getList" />
> </mx:RemoteObject>
> </mx:Application>
>
> i would be thankful for the help regarding this.
>
> Thank u all
>
Ramana
>
__._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Software development tool | Software development | Software development services |
| Home design software | Software development company |
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___

