This is not legal:

click="changeEmployeeView({ emplRptr.currentItem.posnbr)"

 

 "currentItem" only exists while the repeater is processing, and not
when the button is clicked. Also, there is a syntax error. I am
surprised you are not getting errors.

 

You need to use getRepeaterItem(),  for example, in a click handler:

private function onClick(oEvent:Event):void

  var oItem:Object = oEvent.target.getRepeaterItem();

  changeEmployeeView(iItem.posnbr);

 

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tina Scurlock
Sent: Wednesday, November 21, 2007 9:00 AM
To: Douglas Knudsen; [email protected]
Subject: Re: [flexcoders] Repeater is not executing when changing the
dataProvider

 

This is my source.  Whenever the emplViewButton button is clicked, it
retrieves new XML data.

Thank you so much!!
Tina

<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " creationComplete="initMe();">

<mx:Script>
    <![CDATA[
        
    /* Import classes go here including the cairngorm classes */
    import mx.collections.ArrayCollection;
            
    
    private function initMe():void {
        var evt:CairngormEvent = new
CairngormEvent(MyControl.EVENT_GET_REPORT_RESULTS );
        evt.data = MyModel.getInstance().currentUser.POSNBR.toString();
        CairngormEventDispatcher.getInstance().dispatchEvent(evt);
    }

    private function changeEmployeeView( inPosnbr:String ):void {
        var evt:CairngormEvent = new CairngormEvent(
MyControl.EVENT_GET_REPORT_RESULTS );
        evt.data = inPosnbr;
        CairngormEventDispatcher.getInstance ().dispatchEvent(evt);
    }
    ]]>
</mx:Script>
        

    <mx:VBox id="empldata_column">
        <mx:Repeater id="emplRptr" dataProvider="{
MyModel.getInstance().reportEmployeeXML.employee }"> 
            <mx:VBox id="emplInfoVBox">
                <mx:Text id="txtPosnbr" text="{
emplRptr.currentItem.posnbr}"/>
                <mx:Button id="emplViewButton" label="View"
click="changeEmployeeView({ emplRptr.currentItem.posnbr)"/>
            </mx:VBox>
        </mx:Repeater> 
    </mx:VBox>

</mx:Panel> 





On Nov 20, 2007 5:26 PM, Douglas Knudsen <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

what's this about, eh?  ;)  can you share some code?

DK

---------- Forwarded message ----------
From: Tina Scurlock < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> >
Date: Nov 20, 2007 3:00 PM
Subject: [flexcoders] Repeater is not executing when changing the
dataProvider
To: [email protected] <mailto:[email protected]> 



I am having the same problem.  Was there ever a solution for this issue?




RE: [flexcoders] Error: Repeater is not executing.
Tracy Spratt
Tue, 27 Mar 2007 17:04:46 -0800

First you are not doing the repeater quite right.  Try this: 

<mx:Repeater dataProvider="{_main._newss}" id="newsRepeater">
<mx:Label text="{newsRepeater.currentItem.myProperty}"/>
</mx:Repeater>



The currentItem propeerty already holds a reference to the dataProvider 
item that is generating the current repeater instance.



Second, the Label needs a text value, which will be one of the
properties on your dataProvider item objects.



Tracy

________________________________ 

From: [email protected] <mailto:[email protected]>
[EMAIL PROTECTED] On
Behalf Of thierrybertossa
Sent: Tuesday, March 27, 2007 5:31 AM
To: [email protected] <mailto:[email protected]> 
Subject: [flexcoders] Error: Repeater is not executing.



I have a repeater:

<mx:Repeater dataProvider="{_main._newss}" id="newsRepeater">
<mx:Label text="{_main._newss.getItemAt(newsRepeater.currentIndex)}"/>
</mx:Repeater>

_newss, is an instance of a custom Newss Class extends ArrayCollection.

When I change _newss like this: 
_newss = new Newss();

I have an error:
Error: Repeater is not executing.

Is there a way to dynamically change repeater's Dataprovider without 
having this kind of probleme.

Thanks 
Thierry 




-- 
Douglas Knudsen
http://www.cubicleman.com <http://www.cubicleman.com> 
this is my signature, like it? 

 

 

Reply via email to