The answer depends on what you plan to do with the rating?  Are you
storing the rating somewhere? Sending it to the server?  Normally, you
will need to keep track of that field somewhere on the client and the
best place is in your data, so adding a field to FileReference via
subclassing or aggregation (a new class that contains a FileReference
plus a new field) is recommended.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Dan Vega
Sent: Friday, June 06, 2008 12:27 PM
To: [email protected]
Subject: [flexcoders] DataGrid Item Editor Question

 

I have this data grid that holds a list of files. These files are
fileReferences that are selected by a user browsing the system. After
the select a file the data shows the name/ext/size. What I want is a 4th
column for the user to select a value from the drop down. I get an error
with the code below because there is no default value. I am not sure how
I would go about this because the fileReference object does not hold
this data so I can not give it a dataField. I am sure this is because Im
a new, any help is appreciated! 


        <mx:DataGrid id="dgFiles" width="100%" height="100%"
dataProvider="{_files}" editable="true">
            <mx:columns>
                <mx:DataGridColumn headerText="File Name"
dataField="name" editable="false"/>
                <mx:DataGridColumn headerText="File Type"
dataField="extension" editable="false"/>
                <mx:DataGridColumn headerText="File Size"
dataField="size" labelFunction="bytesToKilobytes" editable="false"/>
                <mx:DataGridColumn headerText="Rating" editable="true">
                    <mx:itemEditor>
                        <mx:Component>
                            <mx:ComboBox editable="true">
                                <mx:dataProvider>
                                    <mx:String>1</mx:String>
                                    <mx:String>2</mx:String>
                                    <mx:String>3</mx:String>
                                    <mx:String>4</mx:String>
                                    <mx:String>5</mx:String>
                                </mx:dataProvider>
                            </mx:ComboBox>
                        </mx:Component>
                    </mx:itemEditor>
                </mx:DataGridColumn>
            </mx:columns>
        </mx:DataGrid>


-- 
Thank You
Dan 

 

Reply via email to