...

View Full Version : populating grid based on filtered values in dropdown



svibuk
09-15-2011, 12:49 PM
i am very new to flashbuilder & flex mobile applications , jst started directly with databse application thrí webservice
so in flash builder i have selected flex mobile project

consumed the webservice in the flex application
i have 3 dropdownswhich r populated with data from database thr' web services



i have a grid & a button

i need the grid to be populated with data from databse depending on the values selected from the 3 dropdowns



ie Filter concept

i am not able to do it

ccurrently i have 3 dropdown populated with fields using webservice & a grid control

how to write the filtered query & execute it in the burron click event

Inigoesdr
09-15-2011, 05:35 PM
Post your code.

svibuk
09-16-2011, 06:42 AM
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:service1="services.service1.*"
xmlns:valueObjects="valueObjects.*"
title="HomeView">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;



protected function drpcolor_creationCompleteHandler(event:FlexEvent):void
{
getCentresResult.token = service1.getCentres();
}


protected function drpshape_creationCompleteHandler(event:FlexEvent):void
{
getCentresResult2.token = service1.getCentres();
}


protected function drpclarity_creationCompleteHandler(event:FlexEvent):void
{
getCentresResult3.token = service1.getCentres();
}


protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
getCentresResult4.token = service1.getCentres();
}

]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getCentresResult"/>
<service1:Service1 id="service1"/>
<s:CallResponder id="getCentresResult2"/>
<s:CallResponder id="getCentresResult3"/>
<s:CallResponder id="getCentresResult4"/>

<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<s:Form left="0" right="246" top="61" bottom="467">
<s:FormItem width="166" label="Color:" fontSize="12">
<s:DropDownList id="drpcolor" x="21" y="44" width="86" height="21"
creationComplete="drpcolor_creationCompleteHandler(event)"
labelField="Color">
<s:AsyncListView list="{getCentresResult.lastResult}"/>
</s:DropDownList>
</s:FormItem>
<s:FormItem width="166" label="Shape:" fontSize="12">
<s:DropDownList id="drpshape" x="126" y="44" width="86" height="21"
creationComplete="drpshape_creationCompleteHandler(event)"
labelField="Shape">
<s:AsyncListView list="{getCentresResult2.lastResult}"/>
</s:DropDownList>
</s:FormItem>
<s:FormItem width="166" label="Clarity:" fontSize="12">
<s:DropDownList id="drpclarity" x="231" y="44" width="86" height="21"
creationComplete="drpclarity_creationCompleteHandler(event)"
labelField="Clarity">
<s:AsyncListView list="{getCentresResult3.lastResult}"/>
</s:DropDownList>
</s:FormItem>
<s:FormItem width="230" height="52">
<s:Button id="btnsearch" left="0" top="31" bottom="8" width="167" label="Filter"
fontSize="12"/>
</s:FormItem>
<s:FormItem width="448">
<s:DataGrid id="dataGrid" x="54" y="159" width="365"
creationComplete="dataGrid_creationCompleteHandler(event)" fontSize="12"
requestedRowCount="4">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="Shape" headerText="Shape"></s:GridColumn>
<s:GridColumn dataField="Color" headerText="Color"></s:GridColumn>
<s:GridColumn dataField="Clarity" headerText="Clarity"></s:GridColumn>
</s:ArrayList>
</s:columns>
<s:typicalItem>
<fx:Object Clarity="Clarity1" Color="Color1" Shape="Shape1"></fx:Object>
</s:typicalItem>
<s:AsyncListView list="{getCentresResult4.lastResult}"/>
</s:DataGrid>
</s:FormItem>
</s:Form>
</s:View>


this is the whole thing which i have in .mxml page



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum