5 Replies Latest reply on May 28, 2007 5:35 AM by ankmit

    GO - button to submit the selector values

    ankmit
      hi all,
      in an application there are several selector boxes. now when we make a selection in one of the selector boxes the application changes accordingly. this means the application will refresh everytime a change is made in each selector box.

      the client wants to add a go button so that when all the selections are made on the selectors than he may press the go button and only than the application refreshes according to the selection.

      can somebody help me in this regard. it would be a great help if someone has a working example.
        • 1. Re: GO - button to submit the selector values
          chris.huston.t10 Level 3
          Is this what you are looking for?

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
          <mx:Script>
          <![CDATA[
          [Bindable] private var lower:Array = new Array("a", "b", "c");
          [Bindable] private var upper:Array = new Array("A", "B", "C");
          [Bindable] private var num:Array = new Array(1,2,3);

          private function get_selections():void {
          output_txt.text = b1.selectedLabel + b2.selectedLabel + b3.selectedLabel;
          }
          ]]>
          </mx:Script>
          <mx:Button x="239" y="43" label="go" click="get_selections()"/>
          <mx:ComboBox x="53" y="43" dataProvider="{lower}" id="b1"></mx:ComboBox>
          <mx:ComboBox x="114" y="43" dataProvider="{upper}" id="b2"></mx:ComboBox>
          <mx:ComboBox x="174" y="43" dataProvider="{num}" id="b3"></mx:ComboBox>
          <mx:TextInput x="53" y="103" id="output_txt"/>

          </mx:Application>

          Vygo
          • 2. Re: GO - button to submit the selector values
            ankmit Level 1
            hi, this is a very good example. thanks
            now the situation is that the selections of these selectors are to drive other controls like datagrid. now how to bind the data of these controls by diffrent other controls by a single go button.
            • 3. Re: GO - button to submit the selector values
              chris.huston.t10 Level 3
              Can you give us some idea of the structure of your data and what data is to be bound to the datagrid or other controls? Are you trying to bind selections from multiple comboBoxes to a datagrid? Or do the comboBox selections need to somehow point to a data structure that is then bound to the datagrid?

              Vygo
              • 4. Re: GO - button to submit the selector values
                ankmit Level 1
                i am using a custom environment in which the standard flex controls are customized to take data from an xml file. first we define some data models which fetch data from xml. than we assign them to a control. i would rather choose the second option you gave: -
                comboBox selections need to somehow point to a data structure that is then bound to the datagrid
                for eg

                <mstr:Model id="category" baseModelKey="GridGraph2" templateDefn="r.[r:(2):(1)]" targets="grid"/>
                <mstr:Model id="grid" baseModelKey="GridGraph2" templateDefn="r.[r:(4):(1);r:(5):(1)],c.[c:(1):(1)]"

                <mstr:MstrComboBox x="477" y="28" modelKey="category"/>
                <mstr:MstrDataGrid x="476" y="58" modelKey="grid" width="400"/>

                now you can see in models category model targets grid model which are assigned to individual controls. this code will not work with you as it needs the custom built library.
                now my customer wants that if there were many such compbinations of datagrids and comboboxes than change in the data displayed in the datagrids should change only when the "go" button is pressed. by default it changes as soon as the selection is done. this will help the customer to make selections in many combo boxes at the same time but apply them only once