Flex Datagrid

Problem: Trying to reference a datagid using mx:label.
Normally this is an easy issue to solve but I am using an opensource custome datagrid component by "iwobanas".
Everything is working fine but I cant reference a column.  Normally a datagrid is created by:
<mx:DataGridColumn headerText="Column 1" dataField="col1"/>
.. and to reference a column with a label is
 <mx:Label text="{dg.selectedItem.col1}"/>

but the custom datagrid is different:

<controls:MDataGrid id="dataGrid"
dataProvider="{configitem.example}" width="100%" height="100%" verticalScrollPolicy="on">

 <dataGridClasses:MDataGridColumn dataField="examplelevel" headerText="Primary" width="50" filterEditor="com.iwobanas.controls.dataGridClasses.filterEditors.SliderFilterEditor" />
<dataGridClasses:MDataGridColumn  id="eek" dataField="description" headerText="Description" width="100"/>



Im trying to reference the dataField "description" column and keep getting error

any ideas?
Who is Participating?
zzynxConnect With a Mentor Software engineerCommented:
>> 1120: Access of undefined property dg.
The id of your DataGrid is "dataGrid" not "dg"
zzynxSoftware engineerCommented:
>> Im trying to reference the dataField "description" column
Can't you use the id you've given?

eek  represents the MDataGridColumn you're trying to reference

>> and keep getting error
*How* do you try to reference it and *what error* do you get?
That's *always* good to tell us.
basil099Author Commented:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
	xmlns:controls="com.iwobanas.controls.*" xmlns:local="*"
			import mx.collections.ICollectionView;
<mx:XML id="configitem" source="assets/cidb.xml" />	
<mx:Style source="defaults.css" />
<mx:Panel title="Configuration Item Search" width="95%" height="95%" >

<controls:MDataGrid id="dataGrid" dataProvider="{configitem.ciname}"
	width="100%" height="100%" verticalScrollPolicy="on">			
	dataField="ciname" headerText="CI" width="200" />
dataField="primarylevel" headerText="Primary" width="50"
filterEditor="com.iwobanas.controls.dataGridClasses.filterEditors.SliderFilterEditor" />
dataField="secondarylevel" headerText="Secondary" width="50"
filterEditor="com.iwobanas.controls.dataGridClasses.filterEditors.MultipleChoiceFilterEditor" />

<dataGridClasses:MDataGridColumn id="eek" dataField="description" headerText="Description" width="100"/>



<mx:Label text="{dg.selectedItem.description}"/>

<local:SearchBox target="{dataGrid}" />
<mx:Spacer width="100%" />
<mx:Label text="{ICollectionView(dataGrid.dataProvider).length} / {dataGrid.originalCollection.length}" />

1120: Access of undefined property dg.
<mx:Label text="{dg.selectedItem.description}"/>

Open in new window

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

basil099Author Commented:
<mx:Label text="{datagrid.selectedItem.description}"/>

1120: Access of undefined property datagrid.

zzynxSoftware engineerCommented:
Like I said:
The id of your DataGrid is "dataGrid" not "dg".

And not "datagrid" but "dataGrid" (capital 'G')
zzynxSoftware engineerCommented:
Thanx 4 axxepting
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.