Re: [flexcoders] Struggling with itemRenderer in DataGrid

2007-03-02 Thread Tom Chiverton
On Wednesday 28 Feb 2007, Steve Gustafson wrote:
 Any help is GREATLY APPRECIATED as I am rapidly approaching a deadline.

One - try it first with a straight MXML DataGrid rather than constructing one 
in AS.
Two - your ComboBox DP doesn't match the name of the Array you declared.
 public var myLevels:Array =
..
 mx:ComboBox id=cboLevels dataProvider={myFolders}/




-- 
Tom Chiverton
Helping to adaptively coordinate enterprise-class applications
On: http://thefalken.livejournal.com



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.



 Yahoo! Groups Sponsor ~-- 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/lOt0.A/hOaOAA/yQLSAA/nhFolB/TM
~- 

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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 


[flexcoders] Struggling with itemRenderer in DataGrid

2007-02-28 Thread Steve Gustafson

Help.

I'm trying to use an itemRenderer to create a comboBox in a DataGrid that is
being created with AS.

I can create the comboBox, but I am struggling with being able to change the
dataProvider for the rendered comboBox, and setting the selected index on
the comboBox.

The relevant code I am using is below.

Any help is GREATLY APPRECIATED as I am rapidly approaching a deadline.

Steve

public function createPositionTable():void
{
   _datagrid = positionsGrid;  // positionsGrid is an already created
DataGrid object
   _col1 = new DataGridColumn;
   _col2 = new DataGridColumn;
   _col3 = new DataGridColumn;
   _col4 = new DataGridColumn;
   _col5 = new DataGridColumn;

   _col1.headerText= Position;
   _col1.dataField = Description;
   _col1.editable = true;
   _col1.width = 100;

   _col2.dataField = Type;
   _col2.headerText= Type;
   _col2.editable = true;
   _col2.width = 50;

   _col3.dataField = levelCode;
   _col3.headerText = Level Code;
   _col3.width = 150;
   _col3.editable = false;
   _col3.itemRenderer = new ClassFactory(cbRender);  // HERE IS WHERE I AM
CREATING THE COMBO BOX
   _col3.editorDataField = levelCode;


   _columns = new Array(_col1,_col2,_col3);

   _datagrid.columns = _columns
   _datagrid.sortableColumns = false;
   _datagrid.dataProvider = objAdminTableGridDP;
   _datagrid.dragEnabled = false;
   _datagrid.dragMoveEnabled = false;
   _datagrid.dropEnabled = false;
   _datagrid.editable = true;
   _datagrid.rowHeight = 30;
   updateTablesButton.label = 'Update Positions Table';
}


cbRender.mxml

?xml version=1.0 encoding=utf-8?
mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; width=50 height=25

mx:Script
   ![CDATA[
   import mx.utils.ObjectUtil;
   [Bindable]
   public var myLevels:Array =
   [{label:Accounting, data:accounting},
   {label: Administator, data:1},
   {label:Programmer, data:2},
   {label:Vice President, data:3},
   {label:President, data:4},];

   public var cboLevelID:String = '';

   public function get setLevel():String {
   return cboLevels.selectedItem.data;
   }
   ]]
/mx:Script
   mx:ComboBox id=cboLevels dataProvider={myFolders}/
/mx:VBox