Hello All,
I've been working on simple flex app that creates a remote object from a query in a Coldfusion cfc. I'm trying to set this up so that when a user clicks a row in the datagrid the corresponding "comments" column should display in the text box below the grid.
Is this possible? Currently I've only been able to populate the data from the object into the grid.
My code is below. Any Help would be greatly appreciated.
-C
Here is the flex and cfc code:
==================FLEX CODE==================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/ind
ex.html">
<mx:DataGrid click="{body.htmlText=Stri
ng(conn.se
lectedItem
)}" id="orderGrid" creationComplete="conn.get
Data();" top="40" left="10" right="10" bottom="200" >
<mx:columns>
<mx:DataGridColumn headerText="ID" width="50" dataField="CSG2008_No" />
<mx:DataGridColumn headerText="Property Name" dataField="Project_Name" />
</mx:columns>
</mx:DataGrid>
<mx:Form paddingLeft="10" paddingTop="10" defaultButton="{btnSearch}
" initialize="txtKeywords.se
tSelection
(0, txtKeywords.text.length); txtKeywords.setFocus();" left="0" top="0">
<mx:FormItem label="Keywords:" direction="horizontal">
<mx:TextInput id="txtKeywords"/>
<mx:Button label="Search" click="conn.getData(txtKey
words.text
); txtKeywords.setSelection(0
, txtKeywords.text.length);"
id="btnSearch"/>
</mx:FormItem>
</mx:Form>
<mx:TextArea id="body" editable="false" height="180" bottom="10" right="10" left="10"/>
</mx:Application>
==================CFC=====
==========
===
<cfcomponent output="false">
<cffunction name="getData" access="remote" returntype="query" output="false">
<cfargument name="keywords" type="string" required="false" />
<cfset var local = structNew() />
<cfquery name="local.query" datasource="local">
select PN_ID, Project_Name, CSG2008_No, Comments_2
from con_sites
where CSG2008_No <> ''
<cfif isDefined("arguments.keywo
rds")>
<cfloop index="word" list="#arguments.keywords#
" delimiters=" ">
and ( lcase(Project_Name) like '%#lcase(word)#%' or
lcase(CSG2008_No) like '%#lcase(word)#%'
)
</cfloop>
</cfif>
ORDER BY CSG2008_No ASC
</cfquery>
<cfreturn local.query />
</cffunction>
</cfcomponent>