3 Replies Latest reply on May 30, 2010 10:58 PM by snkd

    How to navigating through the Data using Flex form

    snkd Level 1

      I want to navigate data by using a form.

       

      Suppose there is a form that have fields

      1. Name
      2. Age
      3. Address
      4. etc...

       

      And there is a Buttons

      1. top
      2. bottom
      3. next
      4. previouse

       

      like that....

       

      then there is a arrayCollection came from server side and load it in to Arraycollection by using RemoteObject

      Arraycollection  contain collection of Customers information

       

      [Bindable]

      private var lstCustomers:ArrayCollection = new ArrayCollection();

      Something Like that.....

       

      I need to navigate each an every object and data by using above declared buttons.

      Fields should be filled iby using ArrayColletion....

       

      How can I do that?....Help me...

        • 1. Re: How to navigating through the Data using Flex form
          RUSH-ME Level 3

          Hi

           

          You can keep a selectedMember = 0 property in your application. And for next button click increatment it by one. for previous button click decrease it by one. for top make it 0 and for bottom make it arraycollection.length - 1.

          You can get the Customers information by using stCustomers.getItemAt(selectedMember ) and can show it.

           

          Hope this helps

           

          Rush-me

          1 person found this helpful
          • 2. Re: How to navigating through the Data using Flex form
            snkd Level 1

            Can I have some resource link some thing like code example..? please..?

             

            Actually my arrayCollection contain Customer bean objects...

            that mean There is a class  call Customer and there are properties such as name,age.....etc...

             

            its like following....

             

             

            Class Customer

            {

            public var name:String;

            public var age:int;

            }

             

            I want to get values to form and navigate by clicking next and prevous buttons...

             

            Thankx in advance for any kind of reply...

            • 3. Re: How to navigating through the Data using Flex form
              snkd Level 1

              Original posts are here

               

              http://codexamples.blogspot.com/2010/05/how-to-navigating-through-data-using_30.html


              http://sankadil.blogspot.com/2010/05/how-to-navigating-through-data-using.html

               

               

               

              <?xml version="1.0"?>
              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  backgroundGradientColors="[#FFFFFF, #cce6f8]" width="400" height="100">

               

              <mx:HBox x="0" y="0">
              <mx:TextInput id="tiDebAddress1" text="{lststatus.getItemAt(selectedMember).status}"/>
              <mx:Button id="cmdNext" label="next" click="nextItem()"/>
              <mx:Button id="cmdPrevious" enabled="false" label="previous" click="prevousItem()"/>

               

              </mx:HBox>

               

                  <mx:Script>
                      <![CDATA[
                          import mx.controls.Alert;
                          import mx.collections.ArrayCollection;
                     
                          [Bindable]
                          private var lststatus:ArrayCollection = new ArrayCollection([
                          {status:"a", description:"A | Active"},
                          {status:"b", description:"I | Inactive"},
                          {status:"c", description:"I | Inactive"},
                          {status:"d", description:"I | Inactive"},
                          {status:"e", description:"I | Inactive"},
                          {status:"f", description:"I | Inactive"},
                          {status:"g", description:"I | Inactive"},
                          {status:"h", description:"I | Inactive"},
                          {status:"i", description:"I | Inactive"},
                          {status:"j", description:"B | Blacklisted"}]);
                         
                          private var selectedMember:int =0;
                         
                          private function nextItem():void
                          {
                              if(lststatus.length > selectedMember)
                              {
                                  selectedMember = selectedMember + 1;
                                  tiDebAddress1.text=lststatus.getItemAt(selectedMember).status;   
                                  cmdPrevious.enabled=true;
                                  if(lststatus.length-1 == selectedMember)
                                  {
                                  cmdNext.enabled=false;
                                  cmdPrevious.enabled=true;
                                  }
                                  else
                                  cmdNext.enabled=true;
                              }
                          }
                         
                          private function prevousItem():void
                          {
                              if(lststatus.length > 0 && selectedMember > 0)
                              {
                                  selectedMember = selectedMember - 1;
                                  tiDebAddress1.text=lststatus.getItemAt(selectedMember).status;
                                  if(selectedMember==0)
                                  {
                                  cmdPrevious.enabled=false;
                                  cmdNext.enabled=true;
                                  }   
                                  else
                                  cmdPrevious.enabled=true;
                              }
                          }
                         
                      ]]>
                  </mx:Script>
                 
              </mx:Application>

               

              working app is here....

               

              http://dl.dropbox.com/u/7375335/next.swf

               

               

              thnx....