Your change handler on the ComboBox, "select_DMA" does not do anything.
It needs to do something.  Does the Alert show the correct selected
item?

 

How are you intending to filter the datagrid?  Using a filter function
or re-querying the server?  Your posted code does neither.

 

Also, use a result handler for your RemoteObject call instead of
directly doing the assignment.  This lets you debug your data more
easily.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of pal1626
Sent: Tuesday, October 21, 2008 2:46 PM
To: [email protected]
Subject: [flexcoders] filter datagrid using combox and CF

 

Hi 
I'm new to flex... I'm developing an application in which I have 
combox as filter for datagrid. I do see the data populated in 
datagrid and combox filter but any selection made in combox won't 
change the datagrid. I'm not sure what I'm missing. ANy help is 
appreciated... 

TEST.mxml code...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " 
layout="absolute" creationComplete="init()">

<mx:Script>
<![CDATA[

import mx.controls.Alert;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;

[Bindable]
public var acDMA:ArrayCollection;

private function init():void{

conn.getDMA();

}
//private function changeEvt
(event:Event):void {
//Alert.show(acDMA.getItemAt
(cbDMA.selectedIndex).label);
// 
OrderGrid.text+=event.currentTarget.selectedItem.label + " " + 
// event.currentTarget.selectedIndex + "\n";
//}

private function select_DMA():void {
Alert.show(acDMA.getItemAt
(cbDMA.selectedIndex).label);

}

private function resultgetDMA
(event:ResultEvent):void{

acDMA=ArrayCollection(event.result);

}


]]>
</mx:Script>
<!--Calling CSS Code-->

<!--<mx:Style source="yflexskinGMPW.css"/>-->

<!--Database Server Connection -->
<mx:RemoteObject id="conn" destination="ColdFusion" 
source="TEST.CFCs.Performance"
result="OrderGrid.dataProvider = event.result;" 
showBusyCursor="true">
<mx:method name="getData" result="OrderGrid.dataProvider = 
event.result;" />
<mx:method name="getDMA" result="resultgetDMA(event)" />
</mx:RemoteObject>

<mx:DataGrid id="OrderGrid" left="10" right="10" top="50" 
bottom="50" creationComplete="conn.getData();">
<mx:columns>
<mx:DataGridColumn headerText="Brand" 
dataField="Brand"/>
<mx:DataGridColumn headerText="Campaign" 
dataField="Campaign"/>
</mx:columns>
</mx:DataGrid>
<mx:ComboBox id="cbDMA" dataProvider="{acDMA}" x="10" y="10" 
width="160" change="select_DMA()"/>
</mx:Application>

CFC code
<cfcomponent output="false">
<cffunction name="getData" returnType="query" access="remote" 
output="false">
<cfset var data="">
<cfquery datasource="gmpwMaster" name="data">
SELECT Top 1000 Brand, Campaign 
FROM dbo.perseus_AdAssignment
</cfquery>

<cfreturn data>
</cffunction>

<cffunction name="getDMA" returnType="query" access="remote" 
output="false">
<cfset var DMA ="">
<cfquery datasource="gmpwMaster" name="DMA">
SELECT DISTINCT Division AS label 
FROM dbo.perseus_AdAssignment
ORDER BY Division DESC
</cfquery>

<cfreturn DMA>
</cffunction>
</cfcomponent>

ANy help is appreciated. I think using change property on wrong 
function. 

 

Reply via email to