<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert ;
[Bindable] public var dt:ArrayCollection = new ArrayCollection([
{header:"row1", col1:1, col2:2, col3:3, col4:4},
{header:"row2", col1:5, col2:6, col3:7, col4:8},
{header:"row1", col1:9, col2:10, col3:11, col4:12}
]);
public function buttonClick(e:Event):void
{
if (grid.selectedItem)
Alert.show(grid.selectedItem.col1 );
}
]]>
</mx:Script>
<mx:DataGrid id="grid" dataProvider="{dt}" selectedIndex="1">
<mx:columns>
<mx:DataGridColumn dataField="header"/>
<mx:DataGridColumn dataField="col1" visible="false"/>
<mx:DataGridColumn dataField="col2"/>
<mx:DataGridColumn dataField="col3"/>
<mx:DataGridColumn dataField="col4"/>
</mx:columns>
</mx:DataGrid>
<mx:Button x="10" y="150" label="Button" click="buttonClick(event)"/>
</mx:Application>
FYI, I also tried just commenting out your RemoteObject and putting in the data manually. This works fine, too:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import mx.controls.Text;
import mx.collections.ArrayCollection;
import mx.utils.ObjectUtil ;
import mx.rpc.events.*;
import mx.controls.Alert;
import flash.net.*;
[Bindable]
public var activeMembers:ArrayCollection = new ArrayCollection([
{
cvcontactID:"cvcontactID-1",
cvcompanyName:"cvcompanyName-1",
cvcontactLast:"cvcontactLast-1",
cvcontactFirst:"cvcontactFirst-1",
cvcontactCity:"cvcontactCity-1",
cvstateAB:"cvstateAB-1",
cvcontactZip:"cvcontactZip-1",
cvcountryName:"cvcountryName-1",
cvcontactmemberReg:"cvcontactmemberReg-1",
cvcontactmemberExp:"cvcontactmemberExp-1"
},
{
cvcontactID:"cvcontactID-2",
cvcompanyName:"cvcompanyName-2",
cvcontactLast:"cvcontactLast-2",
cvcontactFirst:"cvcontactFirst-2",
cvcontactCity:"cvcontactCity-2",
cvstateAB:"cvstateAB-2",
cvcontactZip:"cvcontactZip-2",
cvcountryName:"cvcountryName-2",
cvcontactmemberReg:"cvcontactmemberReg-2",
cvcontactmemberExp:"cvcontactmemberExp-2"
},
{
cvcontactID:"cvcontactID-3",
cvcompanyName:"cvcompanyName-3",
cvcontactLast:"cvcontactLast-3",
cvcontactFirst:"cvcontactFirst-3",
cvcontactCity:"cvcontactCity-3",
cvstateAB:"cvstateAB-3",
cvcontactZip:"cvcontactZip-3",
cvcountryName:"cvcountryName-3",
cvcontactmemberReg:"cvcontactmemberReg-3",
cvcontactmemberExp:"cvcontactmemberExp-3"
},
]);
public function initApp():void
{
//myService.getActive();
}
public function clickHandler():void
{
var myvalueName =
myGrid.selectedItem.cvcontactID;
Alert.show (myvalueName);
}
private function resultHandler
(event:ResultEvent):void {
activeMembers = event.result as
ArrayCollection;
}
]]>
</mx:Script>
<!--mx:RemoteObject id="myService" destination="ColdFusion"
source="admin_rpt_AllMembers" showBusyCursor="true">
<mx:method name="getActive" result="resultHandler
(event)" fault="Alert.show(event.fault.message)"/>
</mx:RemoteObject-->
<mx:DataGrid name="myActiveMembers" id="myGrid" width="100%"
height="90%" dataProvider="{activeMembers}" click="clickHandler()">
<mx:columns>
<mx:DataGridColumn headerText="ID" dataField="cvcontactID" visible="false"/>
<mx:DataGridColumn headerText="Company" dataField="cvcompanyName"/>
<mx:DataGridColumn headerText="Last Name" dataField="cvcontactLast"/>
<mx:DataGridColumn headerText="First Name" dataField="cvcontactFirst"/>
<mx:DataGridColumn headerText="City" dataField="cvcontactCity"/>
<mx:DataGridColumn headerText="State" dataField="cvstateAB"/>
<mx:DataGridColumn headerText="Zip" dataField="cvcontactZip"/>
<mx:DataGridColumn headerText="Country" dataField="cvcountryName"/>
<mx:DataGridColumn headerText="Reg" dataField="cvcontactmemberReg"/>
<mx:DataGridColumn headerText="Expires" dataField="cvcontactmemberExp"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
On 7/25/06, michrx7 <
[EMAIL PROTECTED]> wrote:
The RemoteObject is returning simple database values which is why it
is the provider for the datagrid. cvcontactID is a primary key and I
have set the visible value to false in the datagrid. When someone
selects a row I simply want to return the value within the hidden
cvcontactID datagrid column for the selected row.
I guess I could cheat and make the column visible, grab the value,
and then set visible to false, but that seems silly.
--- In [email protected], "Pan Troglodytes"
<[EMAIL PROTECTED]> wrote:
>
> How about an example result from your RemoteObject?
>
> On 7/25/06, michrx7 <[EMAIL PROTECTED]> wrote:
> >
> > <mx:Script>
> > <![CDATA[
> > import mx.controls.Text;
> > import mx.collections.ArrayCollection;
> > import mx.utils.ObjectUtil;
> > import mx.rpc.events.* ;
> > import mx.controls.Alert;
> > import flash.net.*;
> >
> > [Bindable]
> > public var activeMembers:ArrayCollection;
> >
> > public function initApp():void
> > {
> > myService.getActive();
> > }
> >
> > public function clickHandler():void
> > {
> > var myvalueName =
> > myGrid.selectedItem.cvcontactID;
> > Alert.show(myvalueName);
> > }
> >
> > private function resultHandler
> > (event:ResultEvent):void {
> > activeMembers = event.result as
> > ArrayCollection;
> > }
> >
> > ]]>
> > </mx:Script>
> >
> > <mx:RemoteObject id="myService" destination="ColdFusion"
> > source="admin_rpt_AllMembers" showBusyCursor="true">
> >
> > <mx:method name="getActive" result="resultHandler
> > (event)" fault="Alert.show(event.fault.message)"/>
> >
> > </mx:RemoteObject>
> >
> > <mx:DataGrid name="myActiveMembers" id="myGrid" width="100%"
> > height="90%" dataProvider="{activeMembers}" click="clickHandler
()">
> > <mx:columns>
> > <mx:DataGridColumn headerText="ID"
dataField="cvcontactID"
> > visible="false"/>
> > <mx:DataGridColumn headerText="Company"
> > dataField="cvcompanyName"/>
> > <mx:DataGridColumn headerText="Last Name"
> > dataField="cvcontactLast"/>
> > <mx:DataGridColumn headerText="First Name"
> > dataField="cvcontactFirst"/>
> > <mx:DataGridColumn headerText="City"
> > dataField="cvcontactCity"/>
> > <mx:DataGridColumn headerText="State"
> > dataField="cvstateAB"/>
> > <mx:DataGridColumn headerText="Zip"
> > dataField="cvcontactZip"/>
> > <mx:DataGridColumn headerText="Country"
> > dataField="cvcountryName"/>
> > <mx:DataGridColumn headerText="Reg"
> > dataField="cvcontactmemberReg"/>
> > <mx:DataGridColumn headerText="Expires"
> > dataField="cvcontactmemberExp"/>
> > </mx:columns>
> > </mx:DataGrid>
> >
> > --- In [email protected] , "Pan Troglodytes"
> > <chimpathetic@> wrote:
> > >
> > > That doesn't make a lot of sense to me. SelectedItem will be
the
> > item in
> > > the dataprovider, which knows nothing about the grid and which
> > fields are
> > > visible or not.
> > >
> > > Can you post your code?
> > >
> >
> >
> >
> >
> >
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> Jason
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/3EuRwD/bOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
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/
--
Jason __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

