Announcement Announcement Module
Collapse
No announcement yet.
populate flex drop-down with data Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • populate flex drop-down with data

    hi guys

    I have a requirment where i have many drop-down boxes on the flex side and they need to be populated with data when screen loads.
    The data of these drop-downs exist in database tables. what is the best way to populate these drop-downs with data when the screen loads?

    I am thinking to create a reference data implimentation where all the data for the drop downs are retrieved from database table on server start up, does anyone have other good ideas or documents i can refer to?

    thanks

  • #2
    I am thinking to create a reference data implimentation where all the data for the drop downs are retrieved from database table on server start up
    You mean populate when the web server starts up? Some problems i see with that
    1. Server will have the data populated regardless of whether user logs in
    2. Any changes to the data on database-side won't get reflected unless you re-populate the data to the server

    What i would do is, call the server and populate the combos and then show the screen.

    Comment


    • #3
      >>>>What i would do is, call the server and populate the combos and then show the screen.


      Do you have any document which shows this approach?

      thanks.

      Comment


      • #4
        Code:
        var token:AsyncToken = remoteObject.getDataForCombos();
        token.addResponder(
        	new AsyncResponder(
        		function(event:ResultEvent, token:Object = null):void 
        		{
        			var view:YourView = new YourView();
        			view.setComboData(event.result as ArrayCollection);
        			
        			addElement(view);
        		},
        		function(event:FaultEvent, token:Object = null):void 
        		{
        		}
        	)
        );
        1. Call above from some method right before you have to show the screen (i.e. before the user click to load the screen)
        2. Populate the combo with the result.
        3. Add the view to the application so it will get shown

        Comment


        • #5
          hi amiladomingo

          sorry to reply late on this but i have a few questions.

          I have 10 combo boxes, so will this line >>var token:AsyncToken = remoteObject.getDataForCombos(); be repeated 10 times
          for 10 different combo boxes ?

          I am assuming remoteObject.getDataForCombos() will return a combo data for one single combo box, correct?
          In my java backend i have 10 different methods each returning ArrayList data for a combobox. Is that the right approach?

          also >>view.setComboData(event.result as ArrayCollection);
          In this line what is setComboData method ?

          Right now i have my combo in my view defined like this:
          Code:
          <mx:FormItem label="Division:" fontWeight="bold" fontSize="14" width="300">				
          				<mx:ComboBox width="149" dataProvider=""></mx:ComboBox>
          			</mx:FormItem>
          
          <mx:FormItem label="Department:" fontWeight="bold" fontSize="14" width="300">				
          				<mx:ComboBox width="149" dataProvider=""></mx:ComboBox>
          			</mx:FormItem>
          
          <mx:FormItem label="Quota:" fontWeight="bold" fontSize="14" width="300">				
          				<mx:ComboBox width="149" dataProvider=""></mx:ComboBox>
          			</mx:FormItem>
          
          ...so on for 10 times
          Any help will be appreciated,
          thanks

          Comment


          • #6
            I am assuming remoteObject.getDataForCombos() will return a combo data for one single combo box, correct?
            No, It can bring the data for all the combos.

            In my java backend i have 10 different methods each returning ArrayList data for a combobox. Is that the right approach?
            You can return a Map<String, ArrayList>. Where String being the combo box unique id, ArrayList being the data for it.

            Comment

            Working...
            X