DataGrid in flex

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>









Related Tutorials/Questions & Answers:
DataGrid in flex
DataGrid in flex  Hi.... What kind of data grids you can create through Flex applications? please tell me about the datagrid so i can implement it in my application .... Thanks
DataGrid in flex
DataGrid in flex  Hi.... please provide the solution of that problem When I have only a single record, why doesn't it appear in my DataGrid? please give an example Thanks  Ans: This is a caused in flex
Advertisements
DataGrid in flex
DataGrid in flex  Hi..... Please tell me about DataGrid extends which class? please give me the syntax......... Thanks
DataGrid in flex
DataGrid in flex  Hi.... Please tell me What is the data type of the dataprovider property in DataGrid? please give an small example for that.... Thanks
DataGrid in flex
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
DataGrid in flex
DataGrid in flex  Hi........ Please provide the solution of that problem When I add or modify an item in my dataProvider, why doesn't it show up in my DataGrid? Thanks in advance  Ans: When you work
DataGrid in Flex
Adobe Flex DataGrid: In Flex, DataGrid is a kind of list which can display... column. Adobe Flex DataGrid provides many features like columns can be resized... Flex Datagrid Example 1: <?xml version="1.0" encoding="utf-8
Flex DataGrid control
DataGrid in Flex:- A DataGrid is a control in flex which is display data... and display via custom renderers. The main features of the DataGrid is that, you can... a DataGrid and what is the procedure to provide data by array collection. ADS
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
datagrid
datagrid   please send datagrid in jsp lot fields including date
DataGrid ItemRenderer
DataGrid ItemRenderer  Hi... I have a datagrid which contains a Spark dropdownlist that needs to obtain dynamic data. The datagrid uses a separate..." xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com
Flex difference
2. flex ajax bridge 3. Two newly added component Advanced datagrid and OLAP dataGrid 4. Flex component kit for flash CS3 5. cross-domain facility 6. Added...Flex difference  Hi.... please tell me about What
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
ArrayCollection in DataGrid
ArrayCollection in DataGrid  Hi.... I want to know about What are the advantages of using arraycollection as a dataprovider instead of array in DataGrid? please give the ans ASAP....... Thanks
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
editable datagrid
editable datagrid  How to create a editable datagrid in jsp,struts1.3,glassfish v2.x application server and database oracle using netbeans6.8 ide?   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 http
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
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
ComboBox ItemRenderer in DataGrid
combo box itemtenderer in the flex datagrid? please give me an example.....ADS..." xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <
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
Flex ClassFactory
Flex ClassFactory   Hi.... What is ClassFactory and why...;factory object" which Flex uses to generate instances of another class... of a DataGrid control. When we change the item renderer at run time then we have to need
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
Datagrid in JSP - JSP-Servlet
Datagrid in JSP  I Want to display some record in datagrid of JSP page. I am using Apache tomcat server. please help me.  Hi Friend, Please visit the following code: http://www.roseindia.net/jsp/data-grid.shtml
datagrid in JSP - JSP-Servlet
datagrid in JSP  sir i want code t create a datagrid view in JSP. I am using oracle 10g. please help me.  Hi Friend, Please visit the following code: http://www.roseindia.net/jsp/data-grid.shtml Hope
DataGrid Control in Flex4
DataGrid control in Flex4: The DataGrid control is a MX component. There is no spark component. DataGrid Control is like a Table in html. The DataGrid.... It supports for paging. You can use ArrayList or AvtionScript for creating a DataGrid
datagrid search - Hibernate
datagrid search  Hi friend, i have displayed a datagrid using jsp but i need a search option in that which is used to display and sort it in a alphabetical order.... pls help me... Thanks in advance...   
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
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
Flex Looping
Flex Looping  I need example for flex looping mechanisam example
Flex - Framework
Flex  database conectivity in flex
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>
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
Flex basic
Flex basic  Hi...... please just tell me about Can we run Flex applications in MAC? Thanks
Flex and Java
Flex and Java  hi..... Please give similiarities between Java and Flex. Thanks
Flex event
Flex event  Hi.... Please tell me about How to create your own event in flex? Thanks
Flex and Java
Flex and Java  Hi...... Give the name of Collection which can be mapped to java and Flex and vice-versa. please give the name of all collections which is used in flex and java.. Thanks
Flex and Java
Flex and Java  Hi.... What are the config files that are used to connect Java and Flex applications? Please provide the solution of this prob so i connect java and flex.... Thanks
Flex as a Service
Flex as a Service  Hi....... just tell me about How do I run Flex as a service? please give me an example if possible Thanks  Ans: Flex is not a server. It is the pert of your web application. you can use
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
Flex basic
Flex basic  Hi.......... I want to know about What is localToGlobal and globalToLocal in flex? please give me ans ASAP..... Thanks
Flex application
Flex application  Hi..... What kind of applications you can create from flex? please give the name of these applications....... Thanks
Flex basic
Flex basic  Hi.... can you tell me about Is Flex OS specific or operating system independent? please give the description about it....... Thanks
Flex basic
Flex basic  Hi.... I want to know Do we need any plugins to run Flex applications? please give the ans ASAP....... Thanks
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
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

Ads