Creating AdvancedDataGrid in AS

ok I'll try to make this clear as possible.
I've decided to create my AdvancedDataGrid in Actionscript becuase the users want to be able to create columns dynamically.
My service returns a ListCollectionView of object proxies.
Which I then cast into an ArrayCollection of Objects.
private var myADG:AdvancedDataGrid = new AdvancedDataGrid;
 private function generateGrid():void{
var clms:Array; 
myADG.dataProvider=gridData;
myADG.percentWidth=100;
myADG.percentHeight=100;
myADG.visible=
true;myADG.x=0;
myADG.y=0;
myADG.designViewDataType=
"flat";myADG.horizontalScrollPolicy=
"on";myADG.verticalScrollPolicy=
"on";myADG.lockedColumnCount=6;
myADG.sortExpertMode=
true;myADG.headerWordWrap=
true; 
clms = myADG.columns;
//loop to add columns
var adgc:AdvancedDataGridColumn = new AdvancedDataGridColumn(); 
adgc.headerText=
"Sales Order"adgc.dataField=myADG.dataProvider.pdNO;   <-----I have no idea what should be, pdNO is a variable from the list of objects that are returned.
adgc.width=72
adgc.visible=
true; 
clms.push(adgc);
//end loop
myADG.columns=clms;
pan1.addChild(myADG);
I'm a little unclear how to capture the columns from the existing data set (I am just trying to build the grid as is, none of the dynamic stuff yet).
I had this all in MXML before and it was fairly easy to bind the dataField based on each Object property.  But how do I do that now, yes i know it needs to be a loop through an array, but I was just trying to add one column for now to see if I can get it to work.
Thanks in advance, I hope that's clear.

Nevermind, I'm an idiot.  I forgot to actually call the method to generate the grid.  Sorry folks. 
It's working like it should.

Similar Messages

  • Create a tooltip in AdvancedDataGrid

    Hi,
    I would I to ask how to create a tooltip in AdvancedDataGrid.
    I created a new MXML component named CustomToolTip, based on a VBox.
    This is my code for custom tooltip:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"
             implements="mx.core.IToolTip"
             xmlns:s="library://ns.adobe.com/flex/spark"
             xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:services="services.*">
    <fx:Script>
       <![CDATA[
        import mx.controls.Alert;
        import mx.events.FlexEvent;
        [Bindable]
        public var _dataId:String;
        protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
            var dataid:String;
            dataid = _dataId;
            getSpecificUserDataCResult.token = twitterSentimentManager.getSpecificUserDataC(dataid);
        protected function dataGrid2_creationCompleteHandler(event:FlexEvent):void
            var dataid:String;
            dataid = _dataId;
            getSpecificUserDataUResult.token = twitterSentimentManager.getSpecificUserDataU(dataid);
        public var _text:String;
        public function get text():String {
            return _text;
        public function set text(value:String):void {
        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:CallResponder id="getSpecificUserDataCResult"/>
        <services:TwitterSentimentManager id="twitterSentimentManager" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <s:CallResponder id="getSpecificUserDataUResult"/>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Panel width="401" height="300">
        <mx:Image x="52" y="10" width="105" height="91" creationComplete="dataGrid_creationCompleteHandler(event)" source="{getSpecificUserDataUResult.lastResult[0].category}"/>
        <s:Label x="197" y="22" text="Username"/>
        <s:Label x="197" y="55" text="Name"/>
        <s:Label x="197" y="89" text="Bio Info"/>
        <s:Label x="261" y="22" id="username0" text="{getSpecificUserDataUResult.lastResult[0].userID}"/>
        <s:Label x="261" y="55" id="name0" text="{getSpecificUserDataUResult.lastResult[0].name}"/>
        <s:Label x="261" y="89" id="bioinfo0" text="{getSpecificUserDataUResult.lastResult[0].bioData}"/>
        <s:Label x="52" y="140" text="Content"/>
        <s:TextArea x="105" y="140" height="90" text="{getSpecificUserDataCResult.lastResult[0].content}"/>
    </s:Panel>
    <mx:DataGrid id="dataGrid2" creationComplete="dataGrid2_creationCompleteHandler(event)" dataProvider="{getSpecificUserDataUResult.lastResult}" visible="false">
        <mx:columns>
            <mx:DataGridColumn headerText="userID" dataField="userID"/>
            <mx:DataGridColumn headerText="weeklyInfluentialIndex" dataField="weeklyInfluentialIndex"/>
            <mx:DataGridColumn headerText="following" dataField="following"/>
            <mx:DataGridColumn headerText="category" dataField="category"/>
            <mx:DataGridColumn headerText="follower" dataField="follower"/>
            <mx:DataGridColumn headerText="bioData" dataField="bioData"/>
            <mx:DataGridColumn headerText="location" dataField="location"/>
            <mx:DataGridColumn headerText="influentialIndex" dataField="influentialIndex"/>
            <mx:DataGridColumn headerText="name" dataField="name"/>
        </mx:columns>
    </mx:DataGrid>
    <mx:DataGrid id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getSpecificUserDataCResult.lastResult}" visible="false">
        <mx:columns>
            <mx:DataGridColumn headerText="content" dataField="content"/>
            <mx:DataGridColumn headerText="userID" dataField="userID"/>
            <mx:DataGridColumn headerText="sentiment" dataField="sentiment"/>
            <mx:DataGridColumn headerText="dateTime" dataField="dateTime"/>
            <mx:DataGridColumn headerText="contentID" dataField="contentID"/>
        </mx:columns>
    </mx:DataGrid>
    </mx:VBox>
    This is the code for AdvancedDataGrid "AllSentiments.mxml" :
    <?xml version="1.0" encoding="utf-8"?>
    <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:component="component.*, com.hillelcoren.components.*"
               xmlns:components="com.hillelcoren.components.*"
               xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:services="services.*"
               close="titleWindow_close(event)" title="Sentiments">
    <fx:Script>
        <![CDATA[
            import mx.containers.TitleWindow;
            import mx.controls.Alert;
            import mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer;
            import mx.events.CloseEvent;
            import mx.events.FlexEvent;
            import mx.events.ListEvent;
            import mx.events.ToolTipEvent;
            import mx.managers.PopUpManager;
            import spark.components.IItemRenderer;
            import spark.components.TitleWindow;
            [Bindable]
            public var _currentCountryName:String;
            protected function myADG_creationCompleteHandler(event:FlexEvent):void
                var currentCountryName:String;
                currentCountryName = _currentCountryName;
                getSpecificCountryResult.token = twitterSentimentManager.getSpecificCountry(currentCountryName);
            private function createCustomToolTip(event:ToolTipEvent):void {
                var toolTip:CustomToolTip = new CustomToolTip();
                var dataid:String = AdvancedDataGridItemRenderer(event.itemRenderer).data.userID;
                toolTip._dataId = dataid;           
                event.toolTip=toolTip;
            private function deleteToolTip(event:ListEvent):void {
                myADG.toolTip = null;
            ]]>
    </fx:Script>
    <fx:Declarations>
        <s:CallResponder id="getSpecificCountryResult" result="getSpecificCountryCollection.refresh()"/>
        <services:TwitterSentimentManager id="twitterSentimentManager" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
        <mx:GroupingCollection2 id="getSpecificCountryCollection" source="{getSpecificCountryResult.lastResult}">
            <mx:Grouping>
                <mx:GroupingField name="sentiment"/>
            </mx:Grouping>
        </mx:GroupingCollection2>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <mx:AdvancedDataGrid x="48" y="50" id="myADG" designViewDataType="tree" toolTipCreate="createCustomToolTip(event)" selectedIndex="0" creationComplete="myADG_creationCompleteHandler(event)" dataProvider="{getSpecificCountryCollection}">
        <mx:columns>
            <mx:AdvancedDataGridColumn headerText="sentiment" dataField="sentiment"/>       
            <mx:AdvancedDataGridColumn headerText="userID" dataField="userID"/>
            <mx:AdvancedDataGridColumn headerText="dateTime" dataField="dateTime"/>
        </mx:columns>
    </mx:AdvancedDataGrid>
    /s:TitleWindow>
    I got an error:  "1119: Access of possibly undefined property itemRenderer through a reference with static type mx.events:ToolTipEvent."
    May I know where I have done wrong?
    Thanks

    Hi,
    I see that this question is unanswerd for a while, and I came across it when I encountered the same problem.
    If you want to acheive the tootip for each CELL in the datagrid then you can use the ItemOver listener
    setup the listener:
    dg.addEventListener(ListEvent.ITEM_ROLL_OVER , itemOver);
    define itemOver:
    public function itemOver(event:ListEvent):void
                    var toolTipText:String                = (AdvancedDataGridItemRenderer)(event.itemRenderer).text; //only if you want to show the text in the cell itself as the tooltip
                    (AdvancedDataGridItemRenderer)(event.itemRenderer).toolTip    = toolTipText;
    and thats all you have to do.
    Regards
    Faizal

  • How to create summaryRow for HeirarchicalData in AdvancedDataGrid?

    Hi,
    Am working with AdvancedDatagrid..
    Following arraycollection i used as Heirarchical Data for
    Dataprovider of ADG.
    [AS]private static var dpHierarchy:ArrayCollection = new
    ArrayCollection([
    {Region:"Demand",
    children: [
    {Region:"Forecast",
    children: [
    {Region:"Gross Forecast",
    children: [{Region:"Open Forecast"}]},
    {Region:"Net Forecast", value:"20"}]},
    {Region:"Actual",
    children: [
    {Region:"Sales Order",
    children: [
    {Region:"Collaboration",
    children: [
    {Region:"Negotiation", value:"100"},
    {Region:"Authorization", value:"200"},
    {Region:"Published", value:"300"},
    {Region:"Open", value:"400"}]
    }]);[/AS]
    output looks like this...
    >Demand
    >Forecast
    >Gross Forecast
    -Net Forecast 20
    >Actual
    >Sales Order
    >Collaboration
    -Negotiation 100
    -Authorization 200
    -Published 300
    Open 400
    Now what am looking for is need to get the summaryRow at
    parent level...Each and every parent level should have SUM of its
    child.
    i need something like this...
    >Demand
    1020
    >Forecast
    1020
    >Gross Forecast
    1020
    -Net Forecast 20
    >Actual
    1000
    >Sales Order
    1000
    >Collaboration
    600
    -Negotiation 100
    -Authorization 200
    -Published 300
    Open 400
    I created ADG using actionscript. I didnt used MXML tags.
    Now i need to create SummaryRow using Action script only.
    Any idea how to do this??
    Thanks in Advance
    Pratap

    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Automatic Storage Management, OLAP, Data Mining
    and Real Application Testing options
    SQL> spool /orahome/dblog
    SQL> select instance_name from v$instance;
    INSTANCE_NAME
    SBN
    SQL> spool off;
    SQL> ! cat /orahome/dblog.lst
    SQL> select instance_name from v$instance;
    INSTANCE_NAME                                                                  
    SBN                                                                            
    SQL> spool off;
    SQL>

  • AdvancedDataGrid - create Array (cfquery) with children for hierarchical data set

    I'm trying to create an AdvancedDataGrid with a hierarchical
    data set as shown below. The problem that I am having is how to
    call the data from a ColdFusion remote call and not an
    ArrayCollection inside of the Flex app (as below). I'm guessing
    that the problem is with the CFC that I've created which builds an
    array with children. I assume that the structure of the children is
    the issue. Any thoughts?
    Flex App without Remoting:
    http://livedocs.adobe.com/labs/flex3/html/help.html?content=advdatagrid_10.html
    <?xml version="1.0"?>
    <!-- dpcontrols/adg/GroupADGChartRenderer.mxml -->
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable]
    private var dpHierarchy:ArrayCollection= new
    ArrayCollection([
    {name:"Barbara Jennings", region: "Arizona", total:70,
    children:[
    {detail:[{amount:5}]}]},
    {name:"Dana Binn", region: "Arizona", total:130, children:[
    {detail:[{amount:15}]}]},
    {name:"Joe Smith", region: "California", total:229,
    children:[
    {detail:[{amount:26}]}]},
    {name:"Alice Treu", region: "California", total:230,
    children:[
    {detail:[{amount:159}]}
    ]]>
    </mx:Script>
    <mx:AdvancedDataGrid id="myADG"
    width="100%" height="100%"
    variableRowHeight="true">
    <mx:dataProvider>
    <mx:HierarchicalData source="{dpHierarchy}"/>
    </mx:dataProvider>
    <mx:columns>
    <mx:AdvancedDataGridColumn dataField="name"
    headerText="Name"/>
    <mx:AdvancedDataGridColumn dataField="total"
    headerText="Total"/>
    </mx:columns>
    <mx:rendererProviders>
    <mx:AdvancedDataGridRendererProvider
    dataField="detail"
    renderer="myComponents.ChartRenderer"
    columnIndex="0"
    columnSpan="0"/>
    </mx:rendererProviders>
    </mx:AdvancedDataGrid>
    </mx:Application>
    CFC - where I am trying to create an Array to send back to
    the Flex App
    <cfset aPackages = ArrayNew(1)>
    <cfset aDetails = ArrayNew(1)>
    <cfloop query="getPackages">
    <cfset i = getPackages.CurrentRow>
    <cfset aPackages
    = StructNew()>
    <cfset aPackages['name'] = name >
    <cfset aPackages
    ['region'] = region >
    <cfset aPackages['total'] = total >
    <cfset aDetails
    = StructNew()>
    <cfset aDetails['amount'] = amount >
    <cfset aPackages
    ['children'] = aDetails >
    </cfloop>
    <cfreturn aPackages>

    I had similar problems attempting to create an Array of
    Arrays in a CFC, so I created two differents scripts - one in CF
    and one in Flex - to build Hierarchical Data from a query result.
    The script in CF builds an Hierarchical XML document which is then
    easily accepted as HIerarchical Data in Flex. The script in Flex
    loops over the query Object that is returned as an Array
    Collection. It took me so long to create the XML script, and I now
    regret it, since it is not easy to maintain and keep dynamic.
    However, it only took me a short while to build this ActionScript
    logic, which I quite like now (though it is not [
    yet ] dynamic, and currently only handles two levels of
    Hierarchy):
    (this is the main part of my WebService result handler)....
    // Create a new Array Collection to store the Hierarchical
    Data from the WebService Result
    var categories:ArrayCollection = new ArrayCollection();
    // Create an Object variable to store the parent-level
    objects
    var category:Object;
    // Create an Object variable to store the child-level
    objects
    var subCategory:Object;
    // Loop through each Object in the WebService Result
    for each (var object:Object in results)
    // Create a new Array Collection as a copy of the Array
    Collection of Hierarchical Data
    var thisCategory:ArrayCollection = new
    ArrayCollection(categories.toArray());
    // Create a new instance of the Filter Function Class
    var filterFunction:FilterFunction = new FilterFunction();
    // Create Filter on the Array Collection to return only
    those records with the specified Category Name
    thisCategory.filterFunction =
    filterFunction.NameValueFilter("NAMETXT", object["CATNAMETXT"]);
    // Refresh the Array Collection to apply the Filter
    thisCategory.refresh();
    // If the Array Collection has records, the Category Name
    exists, so use the one Object in the Collection to add Children to
    if (thisCategory.length)
    category = thisCategory.getItemAt(0);
    // If the Array Collection has no records, the Category Name
    does not exist, so create a new Object
    else
    // Create a new parent-level Object
    category = new Object();
    // Create and set the Name property of the parent-level
    Object
    category["NAMETXT"] = object["CATNAMETXT"];
    // Create a Children property as a new Array
    category["children"] = new Array();
    // Add the parent-level Object to the Array Collection
    categories.addItem(category);
    // Create a new child-level Object as a copy of the Object
    in the WebService Result
    subCategory = object;
    // Create and set the Name property of the child-level
    Object
    subCategory["NAMETXT"] = object["SUBCATNAMETXT"];
    // Add the child-level Object to the Array of Children on
    the parent-level Object
    category["children"].push(subCategory);
    // Convert the Array Collection to a Hierarchical Data
    Object and use it as the Data Provider for the Advanced Data Grid
    advancedDataGrid.dataProvider = new
    HierarchicalData(categories);

  • How to hide itemRenderers in the Grouped rows of an AdvancedDataGrid?

    I am using an AdvancedDataGrid and showing a comboBox as the itemRenderer and also the editRenderer. However I am seeing the combobox in the grouped rows also. Below is the code I am using and also attached the screenshot of the app. Please help.
    TestAdvGridGrpRen.mxml
    ===================
    <?xml version="1.0"?>
    <!-- dpcontrols/adg/SummaryGroupADGCustomSummary.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
                import mx.collections.IViewCursor;   
                import mx.collections.SummaryObject;
    [Bindable]
    private var dpFlat:ArrayCollection = new ArrayCollection([
      {Region:"Southwest", Territory:"Arizona",
          Territory_Rep:"Barbara Jennings", Actual:38865, Estimate:40000},
      {Region:"Southwest", Territory:"Arizona",
          Territory_Rep:"Dana Binn", Actual:29885, Estimate:30000},
      {Region:"Southwest", Territory:"Central California",
          Territory_Rep:"Joe Smith", Actual:29134, Estimate:30000},
      {Region:"Southwest", Territory:"Nevada",
          Territory_Rep:"Bethany Pittman", Actual:52888, Estimate:45000},
      {Region:"Southwest", Territory:"Northern California",
          Territory_Rep:"Lauren Ipsum", Actual:38805, Estimate:40000},
      {Region:"Southwest", Territory:"Northern California",
          Territory_Rep:"T.R. Smith", Actual:55498, Estimate:40000},
      {Region:"Southwest", Territory:"Southern California",
          Territory_Rep:"Alice Treu", Actual:44985, Estimate:45000},
      {Region:"Southwest", Territory:"Southern California",
          Territory_Rep:"Jane Grove", Actual:44913, Estimate:45000}
                // Callback function to create
                // the SummaryObject used to hold the summary data.
                private function summObjFunc():SummaryObject {
                    // Define the object containing the summary data.
                    var obj:SummaryObject = new SummaryObject();
                    // Add a field containing a value for the Territory_Rep column.
                    obj.Territory_Rep = "Alternating Reps";
                    return obj;
                // Callback function to summarizes
                // every other row of the Actual sales revenue for the territory.
                private function summFunc(cursor:IViewCursor, dataField:String,
                    operation:String):Number {
                    var oddCount:Number = 0;
                    var count:int = 1;
                    while (!cursor.afterLast)
                        if (count % 2 != 0)
                            oddCount += cursor.current["Actual"];
                        cursor.moveNext();
                        count++;
                    return oddCount;
          ]]>
        </mx:Script>
        <mx:AdvancedDataGrid id="myADG"
            width="100%" height="100%"
            initialize="gc.refresh();">      
            <mx:dataProvider>
                <mx:GroupingCollection id="gc" source="{dpFlat}">
                    <mx:Grouping>
                       <mx:GroupingField name="Region"/>
                       <mx:GroupingField name="Territory">
                          <mx:summaries>
                             <mx:SummaryRow summaryObjectFunction="summObjFunc"
                                summaryPlacement="first">
                                <mx:fields>
                                   <mx:SummaryField dataField="Actual" summaryFunction="summFunc"/>
                                </mx:fields>
                             </mx:SummaryRow>
                          </mx:summaries>
                       </mx:GroupingField>
                    </mx:Grouping>
                </mx:GroupingCollection>
            </mx:dataProvider>      
            <mx:columns>
                <mx:AdvancedDataGridColumn dataField="Region"/>
                <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                    headerText="Territory Rep"/>
                <mx:AdvancedDataGridColumn headerText="Actual" dataField="Actual"
                rendererIsEditor="true"
                itemRenderer="TestStatusTypeEditor"
                editorDataField="type"/>
                <mx:AdvancedDataGridColumn dataField="Estimate"/>
            </mx:columns>
       </mx:AdvancedDataGrid>
    </mx:Application>
    TestStatusTypeEditor.mxml
    ====================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="OnInit()" >
    <!-- This is the content of the ComboBox.
    <mx:dataProvider>
    <mx:Object label="Cog" />
    <mx:Object label="Sproket" />
    </mx:dataProvider>
    -->
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
            [Bindable]
            public var cards:ArrayCollection = new ArrayCollection(
                [ {label:"38865", data:1},
                  {label:"29885", data:2},
                  {label:"29134", data:3},
                  {label:"52888", data:4},
                  {label:"38805", data:5},
                  {label:"55498", data:6},
                  {label:"44985", data:7},
                  {label:"44913", data:8}]);
    private function OnInit():void
    dataProvider = cards;
    * This override of set data compares the data.label against the label property
    * of each item in the dataProvider (above). This code is written a bit more
    * generically than necessary, but it would allow you to have a long list
    * in the dataProvider and not have to change this code.
    override public function set data(value:Object):void
    super.data = value;
    var list:ArrayCollection = dataProvider as ArrayCollection;
    for(var i:int=0; i < list.length; i++)
    if( String(value.statusName) == list[i].label ) {
    selectedIndex = i;
    * This getter is the one identified as the editorDataField in the list for
    * the itemEditor.
    public function get type() : String
    if( selectedItem ) {
    return selectedItem.label;
    else {
    return null;
    ]]>
    </mx:Script>
    </mx:ComboBox>

    Solved this issue by using mx:rendererProviders element for my AdvancedGrid. Using the depth parameter gives me the ability to hide the itemRenderer for the Grouped rows.
        <mx:AdvancedDataGrid id="myADG"
            width="100%" height="100%"
            initialize="gc.refresh();">       
            <mx:dataProvider>
                <mx:GroupingCollection id="gc" source="{dpFlat}">
                    <mx:Grouping>
                       <mx:GroupingField name="Region"/>
                       <mx:GroupingField name="Territory">
                          <mx:summaries>
                             <mx:SummaryRow summaryObjectFunction="summObjFunc"
                                summaryPlacement="first">
                                <mx:fields>
                                   <mx:SummaryField dataField="Actual" summaryFunction="summFunc"/>
                                </mx:fields>
                             </mx:SummaryRow>
                          </mx:summaries>
                       </mx:GroupingField>
                    </mx:Grouping>
                </mx:GroupingCollection>
            </mx:dataProvider>       
            <mx:columns>
                <mx:AdvancedDataGridColumn dataField="Region"/>
                <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                    headerText="Territory Rep"/>
                <mx:AdvancedDataGridColumn headerText="Actual" dataField="Actual"
                rendererIsEditor="true"
                editorDataField="type"/>
                <mx:AdvancedDataGridColumn dataField="Estimate"/>
            </mx:columns>
    <mx:rendererProviders>
        <mx:AdvancedDataGridRendererProvider
            columnIndex="2"
            columnSpan="1"
            depth="3"
            renderer="TestStatusTypeEditor"/>
    </mx:rendererProviders>
       </mx:AdvancedDataGrid>

  • How to change the order of groups in AdvancedDataGrid

    Hello,
    I have a dataset similar to the following:
    Region   Sales
    ======   ======
    North     10
    North     15
    South     5
    East      20
    West      5
    West      4
    West      3
    I'd like to group by Region and sort the groups by the Sales subtotal for each group. I already have the data grouped correctly using GroupingCollection2. How can I sort the groups by the sales subtotal (it sorts by region name by default)? I've seen some posts that talk about creating a custom groupingObjectFunction and applying a group sort. But I'm still confused. Can someone give me some pointers on how to achieve this?
    So ideally, the AdvancedDataGrid would end up looking like this with the regions sorted by sales subtotal;
    Region    Sales
    ======    ======
    North
              10
              15
    subtotal 45
    East
              20
    subtotal 20
    West
              5
              4
              3
    subtotal 12
    South
              5
    subtotal 5

    Thanks, I looked at that earlier but it doesn't contain the solution I was hoping to find.
    I ended up not using GroupingCollection. I think GroupingCollection is cool, but it isn't really customizable to the extent I need.
    I just ended up transforming my data into a hierarchical form that could be used directly by AdvancedDataGrid. At the top level of my hierarchy, I have the detail txn groups, subtotal groups, and grand total groups. To sort the groups, I use custom SortFields. So, for example, if I want to sort by group name, I add a SortField for the groupName attribute. Both the Detail Group and the Subtotal Group share the same group name. Then I add a SortField for a summaryRow attribute. Only the subtotal group has that attribute. This ensures that the Detail Group is always followed by the associated Subtotal Group after sorting. I store my groups in an XMLListCollection and then set the sort attribute, then call refresh().
    Not ideal, but it works. If my requirements were more complex, perhaps my approach wouldn't have worked as well. But as it stands it works well and has good performance.
    I was hoping that ADG could handle this kind of sorting for me, but after looking at the source code, it seems like this is not possible without implementing my own custom GroupingCollection class and possibly other supporting classes.
    One key thing to note is that clicking the column header to sort within groups works fine. However, if you then attempt to sort at the group level, ADG hangs while trying to refresh itself. The trick is to assign the dataProvider.sort attribute to a temporary variable, then set it to null (this sort variable contains the ADG column sorts that the user clicked). Apply your group level sort and then reapply the dataProvider.sort attribute.

  • Dynamic Hyperlinks in DataGrid/AdvancedDataGrid

    Forgive me, but when the web was build around hyperlinked text, it should be easier to create hyperlinks in a Rich INTERNET Application.
    Ok - enough griping. I do have a legit question:
    For historical reasons, I have to construct hyperlinks from a number of parameters passed in the URL (aka GET params). Since I write reporting systems, those hyperlinks usually have to appear in a table of some sort: a DataGrid or AdvancedDataGrid.
    My typical code looks something like this:
    <mx:Application blah=blah>
         <mx:Script>
              <![CDATA[
              ]]>
         </mx:Script>
         <mx:HTTPService id="getStuff" method="get" url="http://www.example.com/getData.php" result="processServerData(event)"/>
         <mx:AdvancedDataGrid blah=blah>
              <mx:columns>
                   <mx:AdvancedDataGridColumn blah=blah itemRenderer="ADGcustomItemRenderer"/>
              </mx:columns>
         </mx:AdvancedDataGrid>
    </mx:Application>

    OK, I didn't mean to post that yet. Why can't I edit my post?
    Anyways...
    <mx:Application blah=blah>
         <mx:Script>
              <![CDATA[
                   import a.bunch.of.stuff
                   protected function onInitialize():void {
                        getStuff.send();
              ]]>
         </mx:Script>
         <mx:HTTPService id="getStuff" method="get" url="http://www.example.com/getData.php" result="processServerData(event)"/>
         <mx:AdvancedDataGrid blah=blah>
              <mx:columns>
                   <mx:AdvancedDataGridColumn blah=blah dataField="dataFieldName" itemRenderer="ADGcustomItemRenderer"/>
              </mx:columns>
         </mx:AdvancedDataGrid>
    </mx:Application>
    ADGcustomItemRenderer.mxml
    <mx:Canvas blah=blah>
         <mx:Script>
              <![CDATA[
                   import mx.controls.dataGridClasses.DataGridColumn;
                [Bindable] protected var myURL :String;
                override public function set data(value:Object):void {
                        myURL = '<a href="http://www.example.com/dosomething.php?dept_num=00000&vendor='+value['dataFieldName']+'" target="_blank">'+value['VendorName']+'</a>';
              ]]>
         </mx:Script>
         <mx:Text htmlText="{myURLl}" height="100%" width="100%" />
    </mx:Canvas>
    Notice the dept_num? I need to pass that data to the itemRender, since it can change from page to page (though not row by row) in addition to the column-specific data passed via the "value" object. How can I access that data from the custom itemRenderer?
    Thanks

  • Add Custom Right click menu on editable AdvancedDataGrid

    Hi,
    I have an AdvancedDataGrid whose editable property is set to true and selectionmode is multipleCells.
    Is it possible to display custom right click menu when i right click on any cell? Am getting only the
    default menu items (Cut, Copy, Paste, Select All). Am using ContextMenu and ContextMenuItem class
    for creating the custom right click menu. The same code is working in Flex and not in AIR. Do we have
    to use NativeMenu in Adobe AIR? Please help. Attaching sample of my code.
    <mx:Script>
    <![CDATA[
    [Bindable] 
    private var cMenu:ContextMenu; 
    public function createContextMenu():void {
              cMenu =
    new ContextMenu();     cMenu.hideBuiltInItems();
         cMenu.addEventListener(ContextMenuEvent.MENU_SELECT, contextMenu_menuSelect);
         var cMenuItemCopy:ContextMenuItem = new ContextMenuItem("Copy Data");     cMenuItemCopy.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextMenuItemSelect_Copy);
         var cMenuItemPaste:ContextMenuItem = new ContextMenuItem("Paste Data");     cMenuItemPaste.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextMenuItemSelect_Paste);
         cMenu.customItems.push(cMenuItemCopy);     cMenu.customItems.push(cMenuItemPaste);
    this.contextMenu = cMenu;    
    private  
    function contextMenu_menuSelect(event:ContextMenuEvent):void { }
    private function contextMenuItemSelect_Copy(event:ContextMenuEvent):void {
         copy(event);
     private function contextMenuItemSelect_Paste(event:ContextMenuEvent):void {
         paste(event);
    ]]>
    </mx:Script><mx:AdvancedDataGrid  width="100%" height="72%" id="dProvider" creationComplete="init()"
          editable="true" itemEditBeginning="checkIfAllowed(event)" itemEditEnd="onEditEnd(event)"
          selectionMode="multipleCells" itemRenderer="renderer.ColorForDashBoard" contextMenu="{cMenu}"/ >

    I have same issue too. Can any one help
    Thanks

  • Display restriction in AdvancedDataGrid

    Hi All,
    I am using AdvancedDataGrid for displaying information. I set
    "variableRowHeight= true", so I cannot set the rowCount property I
    guess.
    Now my Grid is displaying information beyond the pageheight
    ie., its adding number of rows as many as possible. But what I
    actually want is that, before displaying each row int he grid, it
    should check whether the new row is having enough display area left
    in the screen to accommodate, then only it should add the row and
    display the information.
    so kindly give your suggestion to acheive that.
    Thanks
    Suren

    Adobe Newsbot hopes that the following resources helps you.
    NewsBot is experimental and any feedback (reply to this post) on
    its utility will be appreciated:
    Flex 3 - Creating inline item renderers and editors:
    assets/brighten.jpg'} ]); ]]> </mx:Script>
    <mx:DataGrid id='myGrid' dataProvider='{initDG}'
    variableRowHeight='true'> <mx:columns>
    <mx:DataGridColumn
    Link:
    http://livedocs.adobe.com/flex/3/html/cellrenderer_6.html
    Tag Archive for datagrid.variablerowheight at Flex Examples:
    Tag Archive for 'datagrid.variablerowheight' ... One of my
    favorite Flex components is the the trusty DataGrid. It seems
    whenever I build some sort of
    Link:
    http://blog.flexexamples.com/tag/datagrid.variablerowheight/
    Flex 3 - List control:
    Note: To use DataTips with a DataGrid control, you must set
    the ... The following example sets the variableRowHeight property
    for a List control to true :
    Link:
    http://livedocs.adobe.com/flex/3/html/dpcontrols_2.html
    Tag Archive for variablerowheight at Flex Examples:
    The following example shows how you can use the Flex TextArea
    control as a drop-in item editor to allow you to easily edit the
    items in a DataGrid control.
    Link:
    http://blog.flexexamples.com/tag/variablerowheight/
    mx.controls.DataGrid (Flex 3):
    The DataGrid width is sized to fit the width of all columns,
    if possible. The default number of displayed rows, including the
    header is 7, and each row,
    Link:
    http://livedocs.adobe.com/flex/3/langref/mx/controls/DataGrid.html
    Flex Monkey Patches variablerowheight:
    Tags: atagrid, datagrid-row, Flex, variablerowheight Posted
    in: Uncategorized. What if you have a datagrid that is only going
    to have a few rows of data,
    Link:
    http://blog.flexmonkeypatches.com/tag/variablerowheight/
    Disclaimer: This response is generated automatically by the
    Adobe NewsBot based on Adobe
    Community
    Engine.

  • AdvancedDatagrid Grouping question

    Getting the hang of this AdvancedDataGrid control. I think it has a lot of potential but I just cant figure out how to do one thing. As you can see from the picture I am grouping by Section and then SubSection. The problem is when there is no subsection data value the items are grouped into a blank folder. Kind of tacky. I wrote this groupLabelingFunction:
    private function groupLabelHandler(data:Object, depth:int):String {
                    var grp:IGroupingCollection = diagnosesGrid.dataProvider.source as GroupingCollection;
                    var grpLabelProperty:String = grp.grouping.label;
                    return (data[grpLabelProperty] == null || data[grpLabelProperty] == "") ? "(No Subsection)" : data[grpLabelProperty];
    And that works great. Instead of a blank folder the folder is titled (No Subsection) however, my boss would instead like those items in that folder to appear in the root of the Section folder. Is there a way to pull them out or get it to ignore the subgrouping when the value is blank?
    Thanks,
    KC

    Hi Guys
    Thanks for your help
    Panda - I think I know what you are meaning but having the lastname in the group header will provide the formatting for the report we require. We really want to show the format as follows
    Client Firstname  Client Lastname    Hour Total
    Jim                     Smith                        8
    Steven                Black                        10
    Would having the lastname in the group header still allow me to keep the above format?
    Travis - I have created the formula you have said however I'm not sure what you mean by "create a group from this formula" can you explain a bit more, sorry I am quite new to crystal reports.
    Thanks

  • How to merge cells in AdvancedDatagrid?

    Hi All,
    I am using advanced datagrid in my project to show hierarchical data.
    we have a requirement to merge related cells so that it will look like below (just like row span in html table)
    1
    1.1
    1.2
    1.3
    2
    2.1
    2.2
    2.3
    For column header it can be done by AdvancedDataGridColumGroup. So there must be some solution to merge cells to create the same effect for row.
    Anyone has any idea on how to achieve this?
    Thanks!!!

    Check out the rendererProviders property on AdvancedDataGrid.  It lets you dynamicaly determine what renderer to use at runtime based on the data being rendered.  It takes a list of AdvancedDataGridRenderer instances, and those instnces have properties for colSpan and rowSpan.

  • Can I use AdvancedDatagrid in an opensource project?

    I have a student Flex Builder education license. Can I use
    AdvancedDatagrid in an opensource project?

    I am new to Swing, and I would like to know, if is
    possible create a application using Swing as view tier
    in a J2EE(EJB) project? Yes, it is entirely possible, they are usually called Rich Clients (as in functionality) and may or may not use RMI/EJB. They typically also include the Controller (from MVC pattern) in the Client. The EJB represent the model, remember that the MVC is a Client Server Pattern, not an J2EE pattern.
    Did anybody create one yet?Yes, the idea is not uncommon, you can read a more here:
    http://www.google.co.uk/search?hl=en&ie=ISO-8859-1&q=Rich+Swing+Java+Client&btnG=Google+Search&meta=
    How many J2EE projects do you know which Swing is used
    as view tier? Using Swing is so much more complicate
    than a ordinary output in HTML? No, just different. Instead of doing each action in your Swing App, use the normal EJB method.
    Is there a open source project uses this approach?Probably, checkout the list of Google links above.
    Here is a sun tutorial, that introduces the principals.
    http://java.sun.com/features/2002/03/whatdev.html
    I don't want to use M$
    Visual Basic anymore! Please, help me! Good for you :-)

  • AdvancedDatagrid scroll bar buttons

    Hello Guys, I've created an AdvancedDataGrid and i've populated it with an XML file. I need to increase the size of the Scroll Bar buttons.
    Is it possible?
    How can I do?
    byee!

    I do not have any linux system, but located this item:
    re; openSUSE
    http://opensuse.14.x6.nabble.com/Scrollbar-arrows-inT-bird-and-FF-td4999329.html
    scroll down as this person fixed the same issue you seem to be experiencing.
    Also Linux REdhat Fedora:
    http://comments.gmane.org/gmane.linux.redhat.fedora.general/424758
    quote:
    ''In my case, something during the upgrade to f17 has changed xfce's
    Appearance/Style to using Adwaita-style. This style lacks arrows
    on scrollbars and therefore hardly usable in scenarios like yours or mine.''
    ''Changing 'Appearance/Style' to a different 'style' through
    Application Menu>Settings'>Appearance->Style
    brought back the arrows.''

  • Can I make a copy of an AdvancedDataGrid Item Renderer?

    I have manual drag-and-drop functionality built in to my
    AdvancedDataGrid (ADG). Right now, I am building my own custom drag
    proxy using a Container instance and grabbing the text to use from
    the "selectedItem" property. This creates a suitable image to drag.
    However, what I'd really like to do is have the drag proxy look
    exactly like the item renderer of the item I'm dragging. I don't
    want the whole row, though, only one cell - that's why I can't use
    the ADG's "dragImage" property. When I run the code below to
    attempt to make a copy of the itemRenderer instance, the
    itemRenderer in the ADG for the source item is cleared out - the
    label disappears. Is there some way to make just a "copy" of the
    itemRenderer instance, so that it doesn't disappear from the
    ADG?

    "ericbelair" <[email protected]> wrote in
    message
    news:gecebe$17j$[email protected]..
    >I have manual drag-and-drop functionality built in to my
    AdvancedDataGrid
    > (ADG). Right now, I am building my own custom drag proxy
    using a Container
    > instance and grabbing the text to use from the
    "selectedItem" property.
    > This
    > creates a suitable image to drag. However, what I'd
    really like to do is
    > have
    > the drag proxy look exactly like the item renderer of
    the item I'm
    > dragging. I
    > don't want the whole row, though, only one cell - that's
    why I can't use
    > the
    > ADG's "dragImage" property. When I run the code below to
    attempt to make a
    > copy
    > of the itemRenderer instance, the itemRenderer in the
    ADG for the source
    > item
    > is cleared out - the label disappears. Is there some way
    to make just a
    > "copy"
    > of the itemRenderer instance, so that it doesn't
    disappear from the ADG?
    >
    > // This is the container I use for my dragProxy
    > var proxyBox:VBox = new VBox();
    >
    > for each (var item:Object in this.selectedItems)
    > {
    > var selectedItemRenderer:IListItemRenderer =
    > super.itemToItemRenderer(item);
    >
    > proxyBox.addChild(DisplayObject(selectedItemRenderer));
    > }
    The itemRenderer is made by the ADG using the ClassFactory of
    the
    itemRenderer class.
    I think you can search for the appropriate ClassFactory for
    that column,
    then make a new renderer from that Factory. Set its data
    and/or listData to
    the same as the existing renderer.
    This might look something like this:
    var factory:IFactory;
    var renderer:IListItemRenderer;
    //populate factory with the appropriate renderer factory
    //you need to do this part
    factory=?;
    renderer = factory.getInstance();
    renderer.data=selectedItemRenderer.data;
    renderer.listData=selectedItemRenderer.listData;
    proxyBox.addChild(DisplayObject(renderer));
    You also might find that you can shortcut this by using new
    (getDefinitionByName(selectedItemRenderer.className)) instead
    of the
    factory.
    HTH;
    Amy

  • How create grouped column in DataGrid ?

    Hi all,
         I can create grouped column in AdvancedDataGrid. So in DataGrid, how I create grouped column ?
    Thanks.

    I have a problem that no anyone can help me to now. Sometime, I think that it's bug of ADG.
    My goal same as from http://blogs.adobe.com/aharui/BlinkWhenChanged/dg.swf . But if I use ADG and with a scroll ! And when scroll up or down background color change not right.
    It's a big problem ! Yep, when I use ADG, I can create group columns but ADG, I can't !
    Is there any ways for me?

Maybe you are looking for

  • Mac-auth-bypass fails MAC: 0000.0000.0000

    I have an old JetDirect that doesn't support 802.1x. I have enabled MAB on the port where it connects, but for some reason MAB fails. I enabled dot1x debug and will paste the output in a few here. I know my dot1x config is good.. i have clients authe

  • Guestbook in flash site

    Hi all, This is my 2nd question. I seen a few guestbooks that involve php and cgi. Can flash achieve a guestbk that will reflect the guest's comments immediately on the remarks in the site without using cgi or php? something like getting the data tha

  • How to back-up ibook g4 on time capsulef

    Hi, I have a 1Tb time capsule that i use to back-up my mbp with no problems -- runs great and I am very happy with the system. However, I would also like to use time capsule to back-up my wife's mac. She has an ibook g4 and runs mac os 10.4.11 so she

  • Passing Parameters and Retrieving them

    Hi, I am trying to learn the JSC2 IDE.Would like to pass a parameter from all my JSP pages.I will have to retrieve this parameter and use it for further processing.I have two things here. 1.How to pass parameters from say from a hyperlink. 2.How to r

  • External load real and target data in SSM?

    Hi, I have a question, Can I load the real and target data  in the "metrics manager" module externally? Any connector is for this? Can I bring from BW the actual and target data? In the "metrics manager" manually load the data ... Is there another wa