[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 783
  • Last Modified:

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?
  • 4
  • 2
1 Solution
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

zzynxSoftware engineerCommented:
>> 1120: Access of undefined property dg.
The id of your DataGrid is "dataGrid" not "dg"
New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

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

Featured Post

How to change the world, one degree at a time.

By embracing technology, we can solve even the biggest problems—including the gender gap.  By earning a degree from WGU, you have an opportunity to gain the knowledge, credentials, and experience it takes to thrive in today’s high-growth IT industry.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now