Hi Folks,

Im trying to make a filter in my dataGrid using XML via HTTPService, but not
success.
My XML is something like this:

<realstates>
             <realstate>
                <mls>123</mls>
                 <class>LOTS/LAND</class>
                 <type>Residential</type>
                <asking_price> 5000 </asking_price>
                <total_sqr> 1000 </total_sqr>
                <total_bedrooms> 5 </total_bedrooms>
            </realstate>
...
</realstates>

I'd like  to filter sobe objects, for example per Type (Residential,
Commercial, etc) using checkbox. And another filter using combobox and
another that the user can type the MLS code... something like that.

Other question, but the same app. I have a picture in each object of this
dataGrid and would like when click in one row shows all the details from
this row (like picture and other information).

Here is my mxml...

...
    <mx:states>
        <mx:State name="detail">
            <mx:RemoveChild target="{dg}"/>
            <mx:RemoveChild target="{linkbutton1}"/>
            <mx:AddChild position="lastChild">
                <mx:Panel width="506" height="332" layout="absolute"
title="Real State" id="pnl1">
                    <mx:Label text="MLS: {dg.selectedItem.mls}"   x="10"
y="10"/>
                    <mx:Label text="Asking Price: ${
dg.selectedItem.asking_price}"  x="10" y="61"/>
                    <mx:Label text="Bedrooms: {
dg.selectedItem.total_bedrooms}"   x="10" y="35"/>
                    <mx:Label text="Total square: {dg.selectedItem.total_sqr}"
x="10" y="113"/>
                    <mx:Label text="Type: {dg.selectedItem.type}"  x="10"
y="87"/>
                    <mx:Label text="Picture:"  x="10" y="139"/>
                    <mx:VBox x="65" y="139" width="238" height="143">
                        <mx:Image source="dg.{ImageRenderer}.selectedItem"
width="237" height="144"/>
                    </mx:VBox>

                </mx:Panel>
            </mx:AddChild>
            <mx:AddChild position="lastChild">
                <mx:LinkButton label="Back" click="currentState=''"/>
            </mx:AddChild>
        </mx:State>
    </mx:states>
...

<mx:Script>
        <![CDATA[
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
            import mx.controls.Alert;
            import mx.controls.dataGridClasses.DataGridColumn;
            import mx.collections.ArrayCollection;

            [Bindable]
            private var imoveis:ArrayCollection;

            private function serviceResultHandler(e:ResultEvent):void
            {
               getData = e.result.realstates.realstate;
            }

            private function serviceFaultHandler(e:FaultEvent):void
            {
                Alert.show('Error trying to connect the database.');
            }

        ]]>
</mx:Script>

<mx:HTTPService id="getData" url="returnXml2.xml"
        result="serviceResultHandler(event)"
        fault="serviceFaultHandler(event)"
        showBusyCursor="true"
    />
<mx:Component id="ImageRenderer">
        <mx:VBox
            width="100%" height="140"
            horizontalAlign="center" verticalAlign="middle">

  <mx:Image source="{'
http://www.bricks-sticks.com/details/pics/POCATELLO'+data.mls+'A.jpg'}"
width="100" height="100" />
</mx:VBox>
    </mx:Component>

<mx:DataGrid id="dg" dataProvider="{getData.lastResult.realstates.realstate}"
width="634" height="424">
<mx:columns>
        <mx:DataGridColumn dataField="mls" headerText="MLS"/>
        <mx:DataGridColumn dataField="class" headerText="Class"/>
        <mx:DataGridColumn dataField="type" headerText="Type"/>
        <mx:DataGridColumn dataField="asking_price" headerText="Price" />
        <mx:DataGridColumn dataField="total_bedrooms" headerText="Bedrooms"
/>
        <mx:DataGridColumn dataField="total_sqr" headerText="Size" />
        <mx:DataGridColumn
                dataField="mls" headerText="Image" width="150"
                itemRenderer="{ImageRenderer}" />
</mx:columns>
</mx:DataGrid>

     <mx:LinkButton label="Details" click="currentState='detail'"
id="linkbutton1" />


Any help will be appreciated.
Thanks in advance,
Arleston

Reply via email to