Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 129821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:51:02+00:00 2026-05-11T05:51:02+00:00

I have the following repeater code: <mx:Repeater id=chapterRepeater dataProvider={Library.Book.Chapter}> <mx:FormItem label=Chapter direction=horizontal> <mx:TextInput width=100

  • 0

I have the following repeater code:

<mx:Repeater id='chapterRepeater' dataProvider='{Library.Book.Chapter}'>    <mx:FormItem label='Chapter' direction='horizontal'>       <mx:TextInput  width='100' text='{ chapterRepeater.currentItem.@Name}'                       change='event.currentTarget.getRepeaterItem().@Name = event.target.text'/>       <mx:NumericStepper maximum='2000' minimum='0' value='{chapterRepeater.currentItem.@Value}'                      change='event.currentTarget.getRepeaterItem().@Value = event.target.value'/>       <mx:Button label='x' width='20' click='delete event.currentTarget.getRepeaterItem()'/>   </mx:FormItem> </mx:Repeater> 

Acting on the following XML

<Library Name='TestLibrary1'>    <Book Name='TestBook1'>       <Chapter Name='TestChapter1' Words='530'/>       <Chapter Name='TestChapter2' Words='490'/>       <Chapter Name='TestChapter3' Words='1030'/>    </Book> </Library> 

This allows the user to edit the names and values of the Chapter objects. However, the ‘delete’ operation doesn’t work for some reason?

Can anyone advise me as to how to reference items within a repeater in order to delete them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:51:02+00:00Added an answer on May 11, 2026 at 5:51 am

    Hmmm… this one has taken me a while to at least get to some sort of solution for it. In your click event (and subsequently the change events on the text area and numericStepper) you access currentTarget. CurrentTarget will actually return a reference to the button itself. As it is a button and not a repeater getRepeaterItem() would not return anything. I’m actually surprised that calling getRepeatItem() hasn’t caused an error to be thrown. Needless to say that i don’t think they were updating the xml.

    My solution externalises the FormItem into it’s own component (as that way, when click is fired i can bubble the event from the FormItem. That way i always know what formItem the event has come from) and then removes the item via an xmlListCollection.

    So i have a separate component called ChapterFormItem.mxml which contains

    <?xml version='1.0' encoding='utf-8'?> <mx:FormItem xmlns:mx='http://www.adobe.com/2006/mxml'>     <mx:Script>         <![CDATA[             private var _chapterData : XML;              [Bindable]             public function get chapterData() : XML             {                 return _chapterData;             }              public function set chapterData(value : XML) : void             {                 _chapterData = value;                }              private function clickHandler(event : MouseEvent) : void             {                 dispatchEvent(new Event('deleteChapter'));             }              private function textInputChangeHandler(event : Event) : void             {                 chapterData.@Name = textInput.text;             }              private function numericStepperChangeHandler(event : Event) : void             {                 chapterData.@Value = numericStepper.value;             }         ]]>     </mx:Script>      <mx:Metadata>         [Event(name='deleteChapter', type='flash.events.Event')]     </mx:Metadata>      <mx:TextInput id='textInput' width='100' text='{chapterData.@Name}' change='textInputChangeHandler(event)'/>     <mx:NumericStepper id='numericStepper' maximum='2000' minimum='0' value='{chapterData.@Value}' change='numericStepperChangeHandler(event)'/>     <mx:Button label='x' width='20' click='clickHandler(event)'/> </mx:FormItem> 

    and in the main application xml (for this example) i have

    <?xml version='1.0' encoding='utf-8'?> <mx:Application xmlns:mx='http://www.adobe.com/2006/mxml' layout='vertical' xmlns:local='*'>     <mx:Script>         <![CDATA[             import mx.collections.XMLListCollection;          import mx.collections.ArrayCollection;          [Bindable]         private var xml:XML = <Library Name='TestLibrary1'>                                    <Book Name='TestBook1'>                                       <Chapter Name='TestChapter1' Words='530'/>                                       <Chapter Name='TestChapter2' Words='490'/>                                       <Chapter Name='TestChapter3' Words='1030'/>                                    </Book>                                 </Library>;          private function itemDeleteHandler(event : Event) : void         {              var chapterItem : ChapterFormItem = event.currentTarget as ChapterFormItem;             var chapterData : XML = chapterItem.chapterData;               var xmlListCollection : XMLListCollection = new XMLListCollection(xml.Book.Chapter);             var chapterDataIndex : int = xmlListCollection.getItemIndex(chapterData);              xmlListCollection.removeItemAt(chapterDataIndex);         }          ]]>     </mx:Script>      <mx:Form width='100%' height='100%'>         <mx:Repeater id='chapterRepeater' dataProvider='{xml.Book.Chapter}'>           <local:ChapterFormItem label='Chapter'                                   direction='horizontal'                                   chapterData='{chapterRepeater.currentItem}'                                  deleteChapter='itemDeleteHandler(event)'  />         </mx:Repeater>      </mx:Form>  </mx:Application> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following ASPX code: <asp:ScriptManager ID=ScriptManager1 runat=server /> <asp:UpdatePanel runat=server ID=UpdatePanel UpdateMode=Conditional>
I have the following code I am trying to consolidate. (here are two examples)
I have the following code that populates an array (this is within a loop):
I have the following structure <asp:UpdatePanel ID=MyUpdatePanel runat=server> <ContentTemplate> <asp:MultiView ID=MyViews runat=server> <asp:View ID=List
I have a sample form with 3 windows. Each window has a label and
I have implemented a list created by a repeater: <ui:repeat value=#{projectData.paginator.list} var=project> <h:outputText value=#{project.title}
I have a bunch of Repository classes which all look a bit like the
I'm using the term partial to refer to a small section of presentational code
I had this simple modal contact form working fine but must have broke it
We have many classes published in a remoting channel as singlecalls. The application resides

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.