Flex Datagrid

Posted on 2010-01-02
Last Modified: 2012-06-21
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?
Question by:basil099
    LVL 37

    Expert Comment

    >> 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.

    Author Comment


    <mx:Application xmlns:mx="" 
    	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

    LVL 37

    Accepted Solution

    >> 1120: Access of undefined property dg.
    The id of your DataGrid is "dataGrid" not "dg"

    Author Comment

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

    1120: Access of undefined property datagrid.

    LVL 37

    Expert Comment

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

    And not "datagrid" but "dataGrid" (capital 'G')
    LVL 37

    Expert Comment

    Thanx 4 axxepting

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Suggested Solutions

    First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
    For Sennheiser, comfort, quality and security are high priority areas. This paper addresses the security of Bluetooth technology and the supplementary security that Sennheiser’s Contact Center and Office (CC&O) headsets provide.  
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now