Hi Tia,
I think this accomplishes what you're trying to do...
<mx:DataGrid id="fileDatagrid" x="0" y="0" width="715" height="130"
dataProvider="{files_datagrid}" selectedIndex="0">
<mx:columns>
<mx:Array>
<mx:DataGridColumn id="prioritycolumn"
dataField="file_priority" headerText="Priority" width="90">
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox
selectedIndex="{data.file_priority- 1}" dataProvider="{
parentDocument.file_prioritylist}"
change="data.file_priority =
this.selectedItem.data" >
<mx:id>fileprioritycb</mx:id>
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:Array>
</mx:columns>
</mx:DataGrid>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
public var file_prioritylist:Array = [{label: "1", data:1},
{label: "2", data:2},
{label: "3", data:3},
{label: "4", data:4}];
[Bindable]
public var file_priority:ArrayCollection = new
ArrayCollection(file_prioritylist);
[Bindable]
public var files_datagrid:ArrayCollection = new ArrayCollection;
private function init():void
{
var tmpArray:Array = new Array();
tmpArray.push({file_priority: 1});
tmpArray.push({file_priority: 2});
tmpArray.push({file_priority: 3});
tmpArray.push({file_priority: 4});
files_datagrid.source = tmpArray;
}
]]>
</mx:Script>
Brendan
On 1/27/07, Impudent1 <[EMAIL PROTECTED]> wrote:
Brendan Meutzner wrote:
> Why not use numeric values for your priority... you wouldn't have to use
a
> special sort function, but instead just use a labelFunction for display
in
> the datagrid to acheive your high/medium/normal/low counts.
Ah nice idea, but I must be thick because I just can't get it to go.
I have the array/collection as:
public var file_prioritylist:Array = ["1", "2", "3", "4" ];
[Bindable]
public var file_priority:ArrayCollection = new
ArrayCollection(file_prioritylist);
I have the labelFunction as:
// priority labelFunction
public function priorityLabelFunc(item:Object):String {
return item.priority + "_teststring";
}
the datagrid is being populated by a remote dataprovider arraycollection
which contains the priority etc:
Bindable]
public var files_datagrid:ArrayCollection;
<mx:DataGrid id="fileDatagrid" x="0" y="0" width="715" height="130"
dataProvider="{files_datagrid}" change="putVideo()" selectedIndex="0">
and the column in question is laid out as:
<mx:DataGridColumn id="prioritycolumn" headerText="Priority" width="90"
dataField="priority" labelFunction="priorityLabelFunc">
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox dataProvider="{parentDocument.file_priority}" >
<mx:id>fileprioritycb</mx:id>
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
Which leads to a error of:
Argument count mismatch on Approval_System/priorityLabelFunc(). Expected
1, got 2.
if I edit it to move the labelfunction to the combobox and parentDocument
it to get to the function I get:
Cannot access a property or method of a null object reference.
I am sure I am just missing something simple so any insight appreciated
Impudent1
LeapFrog Productions
--
Brendan Meutzner
Stretch Media - RIA Adobe Flex Development
[EMAIL PROTECTED]
http://www.stretchmedia.ca