7 Replies Latest reply on Jun 26, 2007 6:55 PM by ntsiii

    two ComboBox related in Datagrid

    Level 7
      Hi All,
      I have two comboBox inside of my datagrid, but the second comboBox values
      depends from the first one. I create a function to fill the comboBox but I
      can find the way to refer to the second comboBox Name
      How can I refer to serviceName_cb??
      Please help. Tks..

      JFB

      public function setServiceName(event:Event):void{
      ??? this.serviceName_cb --> doesn't work ???
      }

      <mx:DataGridColumn headerText="Rate" dataField="rate" editable="false">
      <mx:itemRenderer>
      <mx:Component>
      <mx:VBox>
      <mx:ComboBox id="rate_cb"
      dataProvider="{outerDocument.acComboData}"
      change="outerDocument.setServiceName(event)"></mx:ComboBox>
      </mx:VBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      <mx:DataGridColumn headerText="Service Name" dataField="serviceNameID"
      editable="false">
      <mx:itemRenderer>
      <mx:Component>
      <mx:VBox>
      <mx:ComboBox id="serviceName_cb"></mx:ComboBox>
      </mx:VBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>


        • 1. Re: two ComboBox related in Datagrid
          ntsiii Level 3
          You cannot do it like that.

          You must have the first comboBox update the dataProvider Item, and have the second ComboBox initialize itself from the dataProvider.

          I doubt you can do this with simple in-line renderers.

          Tracy
          • 2. Re: two ComboBox related in Datagrid
            Level 7
            Thanks for you reply,
            Actualy that's what I'm trying right now but looks like the combo is not
            getting the array.
            In my setServiceName function I'm getting set the array for my data provider
            from my cfc.
            In the second combBox I said dataProvider="{outerDocument.acServiceName}"
            but still blank.
            Any example? Any other ideas?

            Tks

            JFB


            public function getServiceNameRO_Handler(event:ResultEvent):void
            {
            acServiceName = ArrayCollection(event.result);
            }

            public function setServiceName(event:Event):void{
            my_RO.getServiceName();
            }



            "ntsiii" <tspratt@lariatinc.com> wrote in message
            news:f5p0te$b23$1@forums.macromedia.com...
            > You cannot do it like that.
            >
            > You must have the first comboBox update the dataProvider Item, and have
            > the
            > second ComboBox initialize itself from the dataProvider.
            >
            > I doubt you can do this with simple in-line renderers.
            >
            > Tracy
            >


            • 3. Re: two ComboBox related in Datagrid
              Level 7
              Can I do filter in the second comboBox?
              Example:
              First dataProvider is customerid and customerName,
              In the second dataProvider I have contactid, customerid and contacName.
              At the begining I can fill all the data to these comboBox but how can I
              filter for the second comboBox?
              It's a way to do this?
              Tks for you help

              JFB


              "ntsiii" <tspratt@lariatinc.com> wrote in message
              news:f5p0te$b23$1@forums.macromedia.com...
              > You cannot do it like that.
              >
              > You must have the first comboBox update the dataProvider Item, and have
              > the
              > second ComboBox initialize itself from the dataProvider.
              >
              > I doubt you can do this with simple in-line renderers.
              >
              > Tracy
              >


              • 4. Re: two ComboBox related in Datagrid
                ntsiii Level 3
                I don't think that will work, because, I don't think a binding is going to work inside the itemRenderers. Also you have a async data service call in the mix.

                If you hardcode data in "acServiceName ", does it work?

                When you debug, what do you see?

                Tracy
                • 5. Re: two ComboBox related in Datagrid
                  Level 7
                  Thanks for you reply and help Tracy,
                  Yes , it works but I see all the data... I want to filter this data for one
                  field like I mention before (only contacts for particular customer)
                  The problem.. outside the datagrid in a function I can't refer to a comboBox
                  because they are probably in array on the datagrid and probably a sub number
                  for the name.
                  Rgds

                  JFB

                  "ntsiii" <tspratt@lariatinc.com> wrote in message
                  news:f5p5i0$g9i$1@forums.macromedia.com...
                  >I don't think that will work, because, I don't think a binding is going to
                  >work
                  > inside the itemRenderers. Also you have a async data service call in the
                  > mix.
                  >
                  > If you hardcode data in "acServiceName ", does it work?
                  >
                  > When you debug, what do you see?
                  >
                  > Tracy
                  >
                  >


                  • 6. Re: two ComboBox related in Datagrid
                    Level 7
                    Another thing Tracy,
                    In my database table I have storage the id numbers for the comboBox like
                    customerID = 243
                    But In my comboBox I display the label but I have also the customerid.
                    When I open de datagrid the comboBox is blank, how can I point to the
                    customerID datafield in my combobox?
                    I have the comboBox with the outerDocument dataprovider but at the first
                    time the comboBox shows empty.
                    Please help.
                    Rgds

                    JFB


                    "ntsiii" <tspratt@lariatinc.com> wrote in message
                    news:f5p5i0$g9i$1@forums.macromedia.com...
                    >I don't think that will work, because, I don't think a binding is going to
                    >work
                    > inside the itemRenderers. Also you have a async data service call in the
                    > mix.
                    >
                    > If you hardcode data in "acServiceName ", does it work?
                    >
                    > When you debug, what do you see?
                    >
                    > Tracy
                    >
                    >


                    • 7. Re: two ComboBox related in Datagrid
                      ntsiii Level 3
                      ComboBox.selectedItem returns a reference to the entire item object.

                      so something like the following, depending on the structure of your item objects: var custId:String = myCombo.selectedItem.customerId

                      You can set the selectedIndex = 0 to select the first item in the combo. To select a specific value, you need to loop over the combo box dataPRovider and match the given value to the appropriate item object property.

                      Tracy