Ok, here we go. It’s a little bit of a trial and error fiddle, but this custom DataGridColum will actually accept an additional DataProvider, call an inline itemEditor, select the current datagrid cell value in the combobox upon  creation, and return any desired data after a combobox selection change. Hope it helps someone... -Iko

 

<?xml version="1.0" encoding="utf-8"?>

<mx:DataGridColumn xmlns:mx="http://www.adobe.com/2006/mxml" editorDataField="selectTest">

     

      <!-- Extended Properties of DataGridColumn -->

      <mx:ArrayCollection id="dataProviderEdit"></mx:ArrayCollection>        

<!-- Dataprovider for combobox itemEditor  -->

     

<mx:String id="returnField"></mx:String>                                     

<!-- Name of the data field that the combobox returns -->

     

<mx:String id="labelFieldCombo"></mx:String>                                 

<!-- Name of the labelField for the combobox -->

 

      <mx:itemEditor>

            <mx:Component>

<mx:ComboBox dataProvider="{outerDocument.dataProviderEdit}" labelField="{outerDocument.labelFieldCombo}" creationComplete="selectThis()" >

                  <mx:Script>

                        <![CDATA[

                        private function selectThis():void

                        {

                              var index:int = -1;                            

                              for(var i:int=0;i<this.dataProvider.length;i++)

                              {

if(this.dataProvider[i][labelField] == parentDocument.dataProvider[parentDocument.selectedIndex][outerDocument.dataField])

                                    {

                                          index = i;

                                          break;

                                    }

                              }

                              this.selectedIndex = (index == -1) ? 0 : index;

                        }

 

                        public function get selectTest():String

                        {

                              return this.selectedItem [outerDocument.returnField];

                        }

                        ]]>

                        </mx:Script>

              </mx:ComboBox>

            </mx:Component>  

      </mx:itemEditor>

 

</mx:DataGridColumn>


From: [email protected] [mailto:[email protected]] On Behalf Of Gordon Smith
Sent: Monday, October 23, 2006 7:13 PM
To: [email protected]
Subject: RE: [flexcoders] Custom DataGridColumn Component?

 

I think it should be possible to write an MXML component based on <mx:DataGridColumn>, although I've never tried it.

 

- Gordon

 


From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of iko_knyphausen
Sent: Monday, October 23, 2006 6:27 PM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] Custom DataGridColumn Component?

 


I am trying to make a custom DataGridColumn that would take a few more
attributes/properties than the standard DataGridColumn. The purpose
would be to pass it a second dataProvider that would be used to populate
an itemEditor, which in turn would be implemented as an inline Component
in the custom Component.

Can it be done as a custom component (mxml), or do I need to go a
different route?

Thanks much - Iko

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to