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

x
  • 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:DataGrid>
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="col1"/>
</mx:columns>
</mx:DataGrid>
.. 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">
<controls:columns>

 <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"/>

</controls:columns>

</controls:MDataGrid>

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


any ideas?
0
basil099
Asked:
basil099
  • 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.
0
 
basil099Author Commented:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
	xmlns:controls="com.iwobanas.controls.*" xmlns:local="*"
	xmlns:dataGridClasses="com.iwobanas.controls.dataGridClasses.*"
	layout="vertical">
	
	
	<mx:Script>
		<![CDATA[
			import mx.collections.ICollectionView;
			
			
		]]>
		
	</mx:Script>
	
<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">			
<controls:columns>
<dataGridClasses:MDataGridColumn 
	dataField="ciname" headerText="CI" width="200" />
                	
<dataGridClasses:MDataGridColumn 
dataField="primarylevel" headerText="Primary" width="50"
filterEditor="com.iwobanas.controls.dataGridClasses.filterEditors.SliderFilterEditor" />
                	
<dataGridClasses:MDataGridColumn 
dataField="secondarylevel" headerText="Secondary" width="50"
filterEditor="com.iwobanas.controls.dataGridClasses.filterEditors.MultipleChoiceFilterEditor" />

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

</controls:columns>

</controls:MDataGrid>

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


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


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

Open in new window

0
 
zzynxSoftware engineerCommented:
>> 1120: Access of undefined property dg.
The id of your DataGrid is "dataGrid" not "dg"
0
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}"/>

ERROR:
1120: Access of undefined property datagrid.

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

And not "datagrid" but "dataGrid" (capital 'G')
0
 
zzynxSoftware engineerCommented:
Thanx 4 axxepting
0

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