DataGrid in flex

Ads
 

DataGrid in flex

Hi.......

I want to know about
How do you access methods in DataGrid from external itemRenderers?
please give an example so i can clearly understand....

Thanks

View Answers

October 21, 2010 at 1:03 PM

Ans:

The following example will be helpful for you please try it.

main.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
width="300" height="150"
layout="absolute" 
creationComplete="init()">
  <mx:Script>
   <![CDATA[
     import mx.collections.ArrayCollection;

     [Bindable]
     private var items:ArrayCollection;

     private function init():void
     {
       items = new ArrayCollection();
       items.addItem(new NameItem("A", true));
       items.addItem(new NameItem("B", false));
       items.addItem(new NameItem("C", false));
       items.addItem(new NameItem("D", true));
       items.addItem(new NameItem("E", false));
     }
   ]]>
 </mx:Script>
<mx:DataGrid dataProvider="{items}" 
  editable="true" width="100%" height="100%">
    <mx:columns>
        <mx:DataGridColumn headerText="Name" 
         dataField="name" editable="false" />
        <mx:DataGridColumn headerText="Access" 
           dataField="access"
           itemEditor="ComboEditor" 
           editorDataField="newValue" width="125"/>
    </mx:columns>
  </mx:DataGrid>
</mx:Application>

The NameItem class is following

package
{
  [Bindable]
  public class NameItem
  {
    public var name:String;
    public var access:Boolean;

    public function SimpleItem(name:String, access:Boolean)
    {
      this.name = name;
      this.access = access;
    }
  }
}

ComboEditor.mxml as an itemrenderer

<?xml version="1.0" encoding="utf-8"?>
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml" 
width="100%" height="100%" horizontalAlign="center">
  <mx:Script>
   <![CDATA[
     override public function set data(value:Object):void
     {
       super.data = value;
       newValue = value.access;
     }
   ]]>
 </mx:Script>
  <mx:Boolean id="newValue" />
  <mx:ComboBox id="comboItem" selectedIndex="{data.access ? 0 : 1}"
     change="{newValue = (comboItem.selectedIndex == 0)}">
    <mx:dataProvider>
      <mx:Array>
        <mx:String>Yes</mx:String>
        <mx:String>No</mx:String>
      </mx:Array>
    </mx:dataProvider>
  </mx:ComboBox>
</mx:Box>

Ads









Related Tutorials/Questions & Answers:
How to add a DropDown List in Flex DataGrid
How to add a DropDown List in Flex DataGrid  hi I am trying to add a DropDownList in a DataGrid table. After the user selects one of the items from... a dropDownList in dataGrid. Pls can u tell me how the selected item in my
How to add a DropDown List in Flex DataGrid
How to add a DropDown List in Flex DataGrid  hi I am trying to add a DropDownList in a DataGrid table. After the user selects one of the items from... a dropDownList in dataGrid. Pls can u tell me how the selected item in my
Advertisements
datagrid
datagrid   please send datagrid in jsp lot fields including date
Datagrid not working
Datagrid not working  The code here is working fine, apart from... the datagrid tag gives an error saying that the items attribute does not accept ant... This works fine for datagrid but then the javascript for drop down menu stops
jsp-datagrid
jsp-datagrid  hello sir.....i have 20 records in my database and i am showing those data in datagrid view but now i want to show 10 data in one page... option in my datagrid view with 1,2 pages....plz help me...awaiting for your
jsp-datagrid
jsp-datagrid  hello sir.....i have 20 records in my database and i am showing those data in datagrid view but now i want to show 10 data in one page... option in my datagrid view with 1,2 pages....plz help me...awaiting for your
ModuleNotFoundError: No module named 'DataGrid'
ModuleNotFoundError: No module named 'DataGrid'  Hi, My Python... 'DataGrid' How to remove the ModuleNotFoundError: No module named 'DataGrid... to install padas library. You can install DataGrid python with following
ModuleNotFoundError: No module named 'DataGrid'
ModuleNotFoundError: No module named 'DataGrid'  Hi, My Python... 'DataGrid' How to remove the ModuleNotFoundError: No module named 'DataGrid... to install padas library. You can install DataGrid python with following
jsp-datagrid
jsp-datagrid  hello sir...i have one view page in which edit and delete option are there in a datagrid view and i want to show data in page wise(pagination)...with previous and next links....i am also attaching my code for your
jsp-datagrid
jsp-datagrid  hello sir...i have one view page in which edit and delete option are there in a datagrid view and i want to show data in page wise(pagination)...with previous and next links....i am also attaching my code for your
jsp-datagrid
jsp-datagrid  hello sir...i have one view page in which edit and delete option are there in a datagrid view and i want to show data in page wise(pagination)...with previous and next links....i am also attaching my code for your
datagrid including combobox
datagrid including combobox  please send datagrid in jsp using mysql database based on id in the datagrid select each record and also update record with available to old values updation is done in form wise. using combo box
Flex Looping
Flex Looping  I need example for flex looping mechanisam example
Flex Combobox
Flex Combobox  flex combobox with database as dataprovider   You can visit the following link for detailed tutorial on the topic. May this will be helpful to you. http://www.roseindia.net/flex/flex-combo-box.shtml
ModuleNotFoundError: No module named 'django-datagrid'
ModuleNotFoundError: No module named 'django-datagrid'  Hi, My... named 'django-datagrid' How to remove the ModuleNotFoundError: No module named 'django-datagrid' error? Thanks   Hi, In your python
Flex Updates
Flex Updates  Sir, first Thanks For Good Resource for Every One! i am New to Flex... but,in Current Updates Tell Us Flex Becomes To down!(Sorry To say).. May I know Future groom & Advantage of Flex Over Other Web
Adding a flex table in another flex table column
Adding a flex table in another flex table column  how to add a flex table in another flex table column
Flex with JSP
Flex with JSP  i want to draw chart in jsp page using flex. how can i do that? any solution??   Flex charts You can visit the following links: http://www.roseindia.net/tutorial/flex/flex4/components/charteffect.html
DataGrid without DataBase
DataGrid without DataBase  I want display list of data without using database. Ex- Employee have some elements like- name, sex, place, designation. I have to display the content of these elements but without having
How to get data datagrid ?
How to get data datagrid ?  How to get data datagrid in jsp from arrayList in java? Code in java CategoryDao dao = new CategoryDao(); ArrayList<Categories> lstCategory = new ArrayList<Categories>
HTML in Flex
Flex application? Please give an example so i can implement it in my apps Thanks  Ans: Yes, you can embed HTML in flex application. You will use the TextArea component for embed An HTML in flex application
Flex-Question
Flex-Question  Hi, i have to take a DOB(date of birth) field and from here i have to calculate age. i am tryin but i am not getting the result......... pls help me
FLex Tree
FLex Tree  I want to change the node name in flex tree my code is: Company:XML = <Element name ="Element" code="400"> <{newChild} name ={newChild1} code="400"/> ; where comapny is dataprovide for tree. I want
Question about a flex...
Question about a flex...  Is there good Future for Adobe flex
ModuleNotFoundError: No module named 'drf-dx-datagrid'
ModuleNotFoundError: No module named 'drf-dx-datagrid'  Hi, My... named 'drf-dx-datagrid' How to remove the ModuleNotFoundError: No module named 'drf-dx-datagrid' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'drf-dx-datagrid'
ModuleNotFoundError: No module named 'drf-dx-datagrid'  Hi, My... named 'drf-dx-datagrid' How to remove the ModuleNotFoundError: No module named 'drf-dx-datagrid' error? Thanks   Hi, In your python
Flex Combobox
Flex Combobox  flex combobox with database as dataprovider  ... on the topic. May this will be helpful to you. http://www.roseindia.net/flex/flex-combo-box.shtml
flex
ModuleNotFoundError: No module named 'flex'
ModuleNotFoundError: No module named 'flex'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'flex' How to remove the ModuleNotFoundError: No module named 'flex' error
ModuleNotFoundError: No module named 'flex'
ModuleNotFoundError: No module named 'flex'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'flex' How to remove the ModuleNotFoundError: No module named 'flex' error
Guide me to learn Flex
Guide me to learn Flex  Guidance to learn Flex Thanks in Advance. Kamal   Please visit the following link: Flex Tutorials

Ads