8 Replies Latest reply on Oct 19, 2010 5:44 AM by welcomecan

    flexdatagrid within combobox issue?

    welcomecan Level 1

      hai friends,

            i am using dynamic datagrid . it include one of the  column include a dynamic combobox.

       

      for example

       

       

      that a dynamic combobox include like

       

      1

      10

      50

      100

      200

       

       

      then i retrive data like this its from db.

       

      sec_rights_level ---> db field name

       

      50   --- > first data

      1     ---> second data

      100   ---> 3rd data

      10

      200

       

      i want selected value(50)  in first row cmbox then

      i want selected value(1) in second row combobox.    i gave like this 

      <s:combobox dataprovider={outdocument.cb_dynamiccb}   selected item={data.db field name}/>// output is not coming

       

       

      give solution

       

       

       

      thanks in advance

      regards,

      welcome canv

        • 1. Re: flexdatagrid within combobox issue?
          Anitha Selvaraj Level 2

          Hi,

           

          Try the below code.

           

          private function setSelectedItem():void {
              combo.selectedItem = data.db field name;
          }
          <s:combobox id="combo" dataprovider={outdocument.cb_dynamiccb} creationComplete="setSelectedItem()"/>

           

          I have also faced a similar problem and the above fix worked for me. I guess, in your code before even setting the dataprovider, the control tries to set the selectedItem for comboBox. Thats why the code is not working.

           

          Regards,

          Anitha

          • 2. Re: flexdatagrid within combobox issue?
            welcomecan Level 1

            but id name not display  within script.check it .

             

            my code is below:

             

            <fx:script>

            <![CDATA[

             

             

            private

             

             

             

             

             

            function setSelectedItem():void {

             

            cb_combo.selectedItem = data.db field name;//  combobox id is not coming.i am getting error.

             

             

            }

             

             

            <mx:DataGrid

             

            id="dg_curtainmanager" showHeaders="true" creationComplete="" variableRowHeight="true" wordWrap="true" dataProvider="{fileListArray}" rowCount="{fileListArray.length}" width="100%" >

             

             

                

            <mx:DataGridColumn

             

            headerText="Rights Level" width="100" minWidth="75" sortable="true" >

             

             

             

             

            <mx:itemRenderer >

             

             

             

            <fx:Component>

             

             

             

            <mx:HBox>

             

             

            <mx:ComboBox id="cb_combo" dataProvider="{outerDocument.first.dataProvider}" labelField="sec_rights_level" creationComplete="setSelectedItem()" />

             

             

            <mx:Label id="lbl_dfcprightlevel" text="{data.dfcp_sec_rights_level}" color="black" />

             

             

            </mx:HBox>

             

             

             

            </fx:Component>

             

             

             

             

             

            </mx:itemRenderer>

             

             

            </mx:DataGridColumn>

             

            </mx:DataGrid>

            • 3. Re: flexdatagrid within combobox issue?
              Anitha Selvaraj Level 2

              Add the fx:Script inside the Hbox. that is just above the combo box tag.

              • 4. Re: flexdatagrid within combobox issue?
                welcomecan Level 1

                Parse error: '<fx:Script>' is not allowed to follow '</mx:HBox>'

                • 5. Re: flexdatagrid within combobox issue?
                  Anitha Selvaraj Level 2

                  Your code should be something like this.

                   

                  <mx:DataGrid id="dg_curtainmanager" showHeaders="true" creationComplete="" variableRowHeight="true" wordWrap="true" dataProvider="{fileListArray}" rowCount="{fileListArray.length}" width="100%" >
                          <mx:DataGridColumn    headerText="Rights Level" width="100" minWidth="75" sortable="true" >
                              <mx:itemRenderer >
                                  <fx:Component>
                                      <mx:HBox>
                                          <fx:Script>
                                              <![CDATA[
                                                  private function setSelectedItem():void {
                                                      cb_combo.selectedItem = data.db field name;
                                                  }
                                              ]]>
                                          </fx:Script>
                                          <mx:ComboBox id="cb_combo" dataProvider="{outerDocument.first.dataProvider}" labelField="sec_rights_level" creationComplete="setSelectedItem()" />
                                          <mx:Label id="lbl_dfcprightlevel" text="{data.dfcp_sec_rights_level}" color="black" />
                                      </mx:HBox>
                                  </fx:Component>
                              </mx:itemRenderer>
                          </mx:DataGridColumn>
                      </mx:DataGrid>

                  • 6. Re: flexdatagrid within combobox issue?
                    welcomecan Level 1

                    <mx:DataGrid id="dg_curtainmanager" showHeaders="true" creationComplete="" variableRowHeight="true" wordWrap="true" dataProvider="{fileListArray}" rowCount="{fileListArray.length}" width="100%" >
                            <mx:DataGridColumn    headerText="Rights Level" width="100" minWidth="75" sortable="true" >
                                <mx:itemRenderer >
                                    <fx:Component>
                                        <mx:HBox>
                                            <fx:Script>
                                                <![CDATA[
                                                    private function setSelectedItem():void {
                                                        cb_combo.selectedItem = data.db field name;//output is not coming


                                                    }
                                                ]]>
                                            </fx:Script>
                                            <mx:ComboBox id="cb_combo" dataProvider="{outerDocument.first.dataProvider}" labelField="sec_rights_level" creationComplete="setSelectedItem()" />
                                            <mx:Label id="lbl_dfcprightlevel" text="{data.dfcp_sec_rights_level}" color="black" />
                                        </mx:HBox>
                                    </fx:Component>
                                </mx:itemRenderer>
                            </mx:DataGridColumn>
                        </mx:DataGrid>

                    • 7. Re: flexdatagrid within combobox issue?
                      Anitha Selvaraj Level 2

                      ???

                       

                      Is that working? or still facing issues?

                      • 8. Re: flexdatagrid within combobox issue?
                        welcomecan Level 1

                        still same issue;