Title: Problem with repeater and datagrid -- Please help!

Hi,

I have a problem with repeater and datagrids.
I have a repeater in ItemSpec.mxml file (below) which includes an mxml component: itemSpecInfo.

File:  itemSpec.mxml
 <mx:Repeater id="specRepeater" dataProvider="{specs}"> 
        …...
           <itemSpecInfo/>
 </mx:Repeater>

ItemSpecInfo.mxml has a datagrid in it. The ItemSpecInfo, being in the repeater, is repeated five times. So basically it displays a page with 5 datagrids.

ItemSpecInfo.mxml also has a remote object call which gets the result from Backend and that result is the dataprovider for the datagrid. The mxml file corresponds to ItemSpecInfo.as actionscript  file. As this ItemSpecInfo is in the repeater, the remote call is made five times which is something I want to avoid. I want the remote call being made only once. So logically I need to put the remote call before the repeater code in ItemSpec.mxml file above. But as I use the result from the remote call in the ItemSpecInfo.as  actionScript file for the dataProvider in ItemSpecInfo, I cannot have the remote call in ItemSpec.mxml because the component child file will not understand the result got in the parent file.

File:  itemSpecInfo.mxml
<mx:Script source="classes/ItemSpecInfo.as"/>
<mx:RemoteObject id="itemDetailController" source="gov.bls.ppi.janus.repricing.manageitems.controllers.ItemDetailController" showBusyCursor="true">

        <mx:method name="getSpecData" result="getSpecVOData(event.result)" fault="mx.controls.Alert.show(event.fault.faultstring, 'getSpecData() Error')">

         <mx:arguments>
                    <arg1>{itemSid}</arg1>
                        <arg2>{irMonth}</arg2>
                        <arg3>{monthNo}</arg3> 
                 </mx:arguments>
        </mx:method>
</mx:RemoteObject>

<mx:DataGrid id="columnar_dg" height="91" textAlign="left" width="524" dataProvider="{specData}" sortableColumns="false" rowHeight="15" headerHeight="14" editable="true" initialize="setHeaders()">

</mx:DataGrid>


I guess there are 2 options and I wanted to know what would work for me:
1. Are there global variables in Flex so that I can take the result from remote call in a global variable and then use it anywhere -- in my case in the child component?

2. Instead of calling the component in the repeater, stick in the entire code for component ItemSpecInfo inside the repeater. But this is causing problems with my datagrid as I need to  indicate which datagrid I am manipulating because my repeater repeats the component 5 times, so I have 5 datagrids displayed.

columnar_dg[0].addColumnAt(0, " "); --> I need to specify indexes for my datagrid.

Any help will be highly appreciated.
Thanks in advance,
Shweta





--
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




Reply via email to