Hi,For repeating your row you are using repeater component.But every time
you add Item in its dataProvider Array it gets refreshed and you values in
previous compoents are deleted.Also you must be facing the problem of
flickering.So the only solutions is add Row (i.e Custom component at runtime
below your previous Row.).Adding a component can be done using AddChild()
Property.So my first advice would be to create a custom component named as
Row.mxml. copy and paste the code below in your component file.Keep this
file in a folder Components in you src folder.

 <mx:GridRow xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="init()"
width="750" horizontalAlign="left">
      <mx:GridItem horizontalAlign="left" width="100%">
          <mx:HBox  verticalAlign="middle" horizontalAlign="left"
width="100%">
             <mx:ComboBox     width="150"></mx:ComboBox>
            <mx:ComboBox ></mx:ComboBox>
            <mx:TextInput id="txtValue" width="150"></mx:TextInput>
        </mx:HBox>
    </mx:GridItem>
</mx:GridRow>


In your main.mxml file Import the above component file.
Than add this tag
<mx:Application>
    <mx:Grid id=grid width="100%"></mx:Grid>
    <mx:Button click="addRow()" label="Add Row"/>
    <mx:Button click="removeRow()" label="Remove">
<mx:Script>
   import Components.*
public function addFilterRows():void
 {
          var r : Row = new Row();       //Row is your compoent mentioned
above
         grid.addChildAt(r,gb);// grid is the Id of you Grid
}
 //Remove Row.
 public function removeFilterRow():void
  {
          gb--;
          grid.removeChildAt(gb);
  }
<mx:/script>
</mx:Application>
So after adding this code everytime you press "Add Row" button a Child (i.e
Row.mxml) is added to the Grid as a new row.
"gb" is the global variable that keeps count of you row.

So copy and paste this code.Rectify all syntax errors. Your problem would be
solved. It is mandatory that you make a custom component.
Thanks & Regards
Vishal
On Sat, Oct 11, 2008 at 3:36 PM, AshishMishra <[EMAIL PROTECTED]>wrote:

>
> Hi Vishal,
>
> Could you explain more on what you want to tell me ? Or can u give a
> sample example from where i can understand this ?
>
> Thanks for ur reply..
>
> Regards
> Ashish
>
> On Oct 11, 11:00 am, "vishal lad" <[EMAIL PROTECTED]> wrote:
> > You can also use Grid.Make a component GridRow as parent Componet.Inside
> > GridItem Tag add Textbox.<?xml version="1.0" encoding="utf-8"?>
> > <mx:GridRow xmlns:mx="http://www.adobe.com/2006/mxml";
> > creationComplete="init()" width="750" horizontalAlign="left">
> >  <mx:GridItem horizontalAlign="left" width="100%">
> > <mx:HBox  verticalAlign="middle" horizontalAlign="left" width="100%">
> >  <mx:ComboBox     width="150"></mx:ComboBox>
> > <mx:ComboBox ></mx:ComboBox>
> > <mx:TextInput id="txtValue" width="150"></mx:TextInput>
> >  </mx:HBox>
> > </mx:GridItem>
> > </mx:GridRow>
> > In the main file Add the code that is at below...
> >
> > public function addFilterRows():void
> > {
> > var r:Row = new Row();//Row is your compoent mentioned above
> > grid.addChildAt(r,gb);// grid is the Id of you Grid}
> >
> > //Remove Row.
> > public function removeFilterRow():void
> > {
> > gb--;
> > grid.removeChildAt(gb);}
> >
> > This way
> > <GridRow>
> > <GridRow>
> > On Fri, Oct 10, 2008 at 9:03 PM, AshishMishra <[EMAIL PROTECTED]
> >wrote:
> >
> >
> >
> > > Hi Friends,
> >
> > > on click on a button, I am adding n number or elements in a
> > > ArrayCollection (newAnswersSkins) on a click on button( AddRowsBtn)
> > > click. Now I am taking a number from a textInput (noOfAnswerSkin) and
> > > adding that many rows into the this ArrayCollection(newAnswersSkins).
> > > Now problem is that when user tries to add more rows, the previous
> > > rows data gets cleared. Can somebody, what is wrong herer? You can see
> > > the code here :
> >
> > >  [Bindable]
> > >  public var newAnswersSkins:ArrayCollection = new
> > > ArrayCollection();
> >
> > > public function addRows():void{
> > >    var noOfAnswerSkins:int = parseInt(noOfAnswerSkin.text);
> > >    for(var i:int =0; i<noOfAnswerSkins;i++){
> > >        newAnswersSkins.addItem({key:0, answerSkin:""});
> > >    }
> > >    noOfAnswerSkin.text = "1";
> > > }
> >
> > > <mx:NumberValidator source="{noOfAnswerSkin}" property="text"
> > > integerError="Please Enter Integer value"
> > >        domain="int" trigger="{AddRowsBtn}" triggerEvent="click"
> > > valid="addRows();"
> > >        invalidCharError="Please Enter A Valid Value"/>
> >
> > > <mx:VBox id="dataPrompt" horizontalScrollPolicy="off" height="100%">
> > >       <mx:HBox horizontalScrollPolicy="off"
> > > verticalScrollPolicy="off" horizontalGap="10">
> > >               <mx:Label width="40" text="Select"/>
> > >               <mx:Label width="162" text="Standard Answer Skin"/>
> > >                <mx:Label  width="132" text="{stdAnswer}"/>
> > >                <mx:Label  width="132" text="Sequence"/>
> > >        </mx:HBox>
> > >        <mx:VBox id="newStdAnswerSkin" horizontalScrollPolicy="off">
> > >                       <mx:Repeater id="stdNewAnswerRepeater"
> > > dataProvider="{newAnswersSkins}">
> > >                           <mx:HBox horizontalScrollPolicy="off"
> > > horizontalGap="10">
> > >           <mx:CheckBox width="40"
> > > data="{stdNewAnswerRepeater.currentIndex}"
> > > click="setSequence(event)"/>
> > >           <mx:TextInput id="newAnswerSkin" width="162"
> editable="true"/>
> > >           <mx:TextInput id="newAnswer" width="132" editable="true"/>
> > >          <mx:TextInput id="newAnswerSeq" width="132" text=""/>
> > >                           </mx:HBox>
> > >                        </mx:Repeater>
> > >        </mx:VBox>
> > >        <mx:HBox horizontalScrollPolicy="off" >
> > >                       <mx:Label text="Please add" />
> > >                        <mx:TextInput id="noOfAnswerSkin" width="50"
> > > text="1"/>
> > >                        <mx:Label text=" new answer options."/>
> > >                        <mx:Button id="AddRowsBtn" label="Add Rows"/>
> > >        </mx:HBox>
> > > </mx:VBox>
> >
> > > Thanks for ur replies in advance...
> >
> > > Regards,
> > > Ashish Mishra
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to