Multiple ArrayCollection as DataProvider

Hi,
I've multiple source of XML which are saved as multiple
ArrayCollections in Flex. I've a single datagrid, which shows some
of the each ArrayCollection's elements in it. How could I
merge/throw those multiple ArrayCollection as DataProvider in the
datagrid?
Any help..?
ASB

You will need to concatenate the ArrayCollections into one,
as there is no way to specify multiple dataProviders for a single
control. This might be easier to do within XML (before wrapping it
in an ArrayCollection), depending on what your data looks
like.

Similar Messages

  • Strange Behaviour on DataGrid with ArrayCollection as DataProvider

    I have a Datagrid with an ArrayCollection as DataProvider, the arrayCollection is partially generated by a remoteObject call, the dataprovider seems to works at least until I try to edit the field...
    By the RemoteObject I only receive an ArrayCollection with the field `ip`, but the datagrid looks for the fields ip, check and save...
    If I add/edit this new field it works, but only under particular condition
    The DataGrid:
    <s:DataGrid id="datagrid" left="10" right="10" top="136"
           dataProvider="{listaIPCheck}" bottom="10" requestedRowCount="4">
              <s:columns>
                    <s:ArrayList>
                         <s:GridColumn dataField="ip" headerText="Asset"/>
                         <s:GridColumn dataField="check" headerText="Inventory"/>
                         <s:GridColumn dataField="save" headerText="Salvataggio"/>
                    </s:ArrayList>
               </s:columns>
    </s:DataGrid>
    The Script:
       [Bindable]private var listaIPCheck:ArrayCollection;
        private function ro_resultHandler(event:Event=null):void
          listaIPCheck = new ArrayCollection();
          listaIPCheck = ro.getListUpdate.lastResult;
          heap = 0;
          // Read Below {POINT #1}
          init3();
        private function init3():void
         // Read Below {POINT #2}
         if (heap<listaIPCheck.length)
            // omitted the initialization of the process p
            p.addEventListener(NativeProcessExitEvent.EXIT, onExit);
            try{
              p.start(startupInfo);
            }catch(e:Error){}
        private function onExit(e:NativeProcessExitEvent):void {
            // Read below {POINT #3}
    Here is my code, now as you can see there are 3 line where I wrote to read below...
    Let's assume to put this simple `for` instead of the commented line (once at a time)
        for (var k:Number=0;k<listaIPCheck.length;k++)
          listaIPCheck.getItemAt(k).check = "checkVal";
          listaIPCheck.getItemAt(k).save = "saveVal";
    This code always work in the 3 points, so at the end of the call the ArrayCollection is always filled with the new values, but the datagrid refresh the items only in POINT #1 and POINT #2
    Why not in Point #3???

    Thank you Amy, but adding the properties in the server side did not work...
    The workflow of the program is that:
    1) I get the ArrayCollection (listaIPCheck) contatining some information  (function ro_resultHandler)
    2) I start an external process and grab the output data (function init3)
    3) read and use the data from the process (function onExit)
    Now the problem I have is regarding the refresh of the datagrid, this datagrid has the ArrayCollection (listaIPCheck) as DataProvider.
    So:
    - If I put the for loop instead of the comments  ( // Read Below {POINT #1} ) or
    ( // Read Below {POINT #2} )  it works, the ArrayCollection is updated and the datagrid is refreshed
    - Whereas if I put the for loop instead of  ( // Read Below {POINT #3} ) , it won't work.. or at least, the ArrayCollection is correctly updated, but the datagrid is not refreshed at all and I have to use .refresh()

  • ArrayCollection for dataProvider

    Hello every one,
    I'm a new french user here, so please be gentle :)
    My problem is that i'm trying to get a good arraycollection
    from my xml entirely in as3.
    I've already created my advancedDataGrid, put columns on it,
    I've also tried to put direct data on it and it works like
    that:
    var colDatas:ArrayCollection = new ArrayCollection(
    [{COL1:"test",COL2:"toust"}]);
    but my problem is that i don't understand how to get a
    correct arrayCollection dynamicaly from my xml.
    here is my XML:
    ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <DONNEES>
    <WS COL1="CL" COL2="********" COL3="GENERAL" COL4="BOULOC"
    COL5="31620" COL6="FRANCE" COL7="11" COL8="22" COL9="CONTACT"
    COL10="A" srowid="" srecid="279" ligne="1" />
    <WS COL1="AF" COL2="ABODINO33" COL3="ABODINO33" COL4="4
    CHEMINS (LES)" COL5="12500" COL6="FRANCE" COL7="101" COL8="102"
    COL9="888" COL10="A" srowid="" srecid="345" ligne="2" />
    <WS COL1="CL" COL2="ALAIN66" COL3="ALAIN" COL4="PERPIGNAN"
    COL5="66000" COL6="FRANCE" COL7="" COL8="" COL9="" COL10="A"
    srowid="" srecid="428" ligne="3" />
    <WS COL1="CL" COL2="BONNY31" COL3="BONNY" COL4="TOULOUSE"
    COL5="31000" COL6="FRANCE" COL7="" COL8="" COL9="" COL10="A"
    srowid="" srecid="426" ligne="4" />
    </DONNEES>
    and here is the code i wrote and which does'nt work:
    public function modifDataList(pEvt:Event):void{
    var dataXml:XML = new XML(pEvt.target.data);
    var resultArray:Array = new Array();
    var nbColumnsData:Number = dataXml.WS.length();
    for(var j:Number = 0;j<nbColumnsData;j++){
    var obj:Object = new Object();
    var attribNb:Number = dataXml.WS[j].attributes().length();
    for(var k:Number = 0;k<attribNb;k++){
    obj[k]=dataXml.WS[k].attributes();
    trace(obj[k]);
    resultArray.push(obj);
    var colDatas:ArrayCollection = new
    ArrayCollection(resultArray);
    advDataGrid.dataProvider= colDatas;
    my goal is to make it dynamic because i don't receive the
    same number of attributes with all xmls.
    If you have any suggestion...
    thank you all.

    Theory looks good. Where is it failing?
    Tracy

  • Data Grid wilth Multiple ArrayCollections

    I am using an array collection to store a month name and a
    list of the monthly sales for a list of people, which are in their
    own array collection. Adding an item to the array collection looks
    something like this:
    myCollection.add({month:"January",salesArray:someArrayCollection});
    Where someArrayCollection has the January sales for a number
    of people. The point of setting it up this way is that the size of
    the embedded array collection (the number of people to display)
    changes depending on what geography the user selected. Simply
    binding this to a data grid leaves me with two columns, one listing
    the months, and the other listing all the people's sales for that
    month separated by commas within the grid tile. How can I break
    these out into separate columns?
    I know that you can list out the DataGridColumns within a
    DataGrid and specify which field the column refers to. I'm trying
    to find a way to set the dataField attribute to a particular item
    within the embedded array. I would think that the code would be:
    dataField="salesArray.getItemAt(0)"
    to return the first person's sales in it's own column, but
    this doesn't work. Any advice would be greatly appreciated.

    Hi GWD and thanks for responding.
    I fully understood your explanations and the example you
    provided.
    I'll give it a try, for sure.
    But I want to know:
    - How do I populate a DataGrid Component? Like a List
    Component? (you said they are quite the same, I assume methods to
    apply are identical...)
    -In the same way, I can pull out the data from a DataGrid as
    I do for the List, right?
    Thanks again!
    Best,
    gerry

  • ArrayCollection field as ComboBox dataProvider question

    I have an ArrayCollection defined like this:
    public var test:ArrayCollection = new ArrayCollection([
    { Id:"one", Amount:2000 },
    { Id:"two", Amount:1000 },
    { Id:"three", Amount:200 } ]);
    And i would like to make 'Id' field of 'test' ArrayCollection
    as dataProvider for a ComboBox compoenent but can't figure it out
    how.I tried with following but get an error:
    comboName.dataProvider = test.Id;
    Can someone please help me with this?
    thanks in advance

    Dang, i totally forgot about 'labelField' property which
    solves the problem:
    comboName.labelField = "Id";
    :)

  • From ArrayCollection to Array in DataBinding

    Hi,
    I am trying to use somebody else's visual component (have src code of that mxml),
    which uses Array items as a DataSource.
    In my program I use ArrayCollection to hold my data (from the data feed - changes in real time).
    I need to pass some data from my ArrayCollection into that component inside the binding,
    something like:
    <view:Component1  items="{dataArrayCollection}"?? />
    currently have in Component1.mxml:
    public function set items(a:Array):void {...}
    Since that component is pretty complicated, I would not want to break its logic,
    so I am thinking of adding some data adapter, public method to Component1 like:
    public function set dataProvider(ac:ArrayCollection):void {
    Array tempArr = new Array();
    // copy some data from ac -> tempArr
    items(tempArr);
    and do: <view:Component1  dataProvider="{dataArrayCollection}" />
    Is there a more efficient way of doing that (I guess, "set dataProvider" will be called a lot, on each update)?
    I don't think I can just straight convert ArrayCollection -> Array, need just a small subset of data.
    Please advise.
    TIA,
    Oleg.

    Alex,
    A friend suggested me another solution, which I tried and it seems to work and be more straightforward:
    main.xml:
    [Bindable]
      private var ac : ArrayCollection;
    <component dataProvider="{ac}" />
    Component.xml:
    [Bindable]       
    public var dataProvider:ArrayCollection;
    private function onCreationComplete():void {
       dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE, onDataProviderUpdate);
    public function onDataProviderUpdate(e:*=null):void {
                    if (dataProvider == null) {                  
                        return;
                    var aca:Array = dataProvider.source;                                
                    var dev1:Object = aca[0];    // process only 1 element of that AC                   
                    var dev:Device = new Device();
                    dev.cpu = dev1["cpu"];
                    // pass to items array
                    if (_items == null) {    // if new                    // _items - component's data array              
                        _items = new Array();
                        _items.push(dev);                                                
                    } else {                   
                        _items.push(dev);    
                        updateData();                   
                    updateView();                          
    Do you like that solution ?
    The only problem I see is that when the feed runs, the size of the browser memory grows fast,
    so by element 60 it slows down, by 95 memory consumption grows to 1.4GB and browser crashes.
    I do not think it is related to that data binding, but not positive.
    Can it be array.push() ?
    Any way to force garbage collection in Flex ?
    Please advise,
    Oleg.

  • Why is it different using ArrayCollection and XMLListCollection?

    As shown in the screenshot below. The first one has ArrayCollection as dataProvider. The second one has XMLListCollection as dataProvider.
    I would like the result for XMLListCollection but now I only have ArrayCollection as input. How can I deal with it? Thanks!
    <?xml version="1.0" encoding="utf-8"?> 
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" >
              <mx:Script> 
                        <![CDATA[ 
                                  import mx.collections.ArrayCollection; 
                                  [Bindable] 
                                  private var dp:ArrayCollection = new ArrayCollection([ 
                                            {name: "00:00:00", v1: "2"},
                                            {name: "00:15:00", v1: "3"},
                                            {name: "00:30:00", v1: "4"},
                                            {name: "00:45:00", v1: "3"},
                                            {name: "01:00:00", v1: "5"},
                                            {name: "01:15:00"},
                                            {name: "01:30:00"},
                                            {name: "01:45:00"},
                                            {name: "02:00:00"}
                        ]]>
              </mx:Script> 
              <mx:XMLListCollection id="dp2">
                        <mx:source>
                                  <mx:XMLList>
                                            <hour name="00:00:00" v1="2"/>
                                            <hour name="00:15:00" v1="3"/>
                                            <hour name="00:30:00" v1="4"/>
                                            <hour name="00:45:00" v1="3"/>
                                            <hour name="01:00:00" v1="5"/>
                                            <hour name="01:15:00" />
                                            <hour name="01:30:00" />
                                            <hour name="01:45:00" />
                                            <hour name="02:00:00" />
                                  </mx:XMLList>
                        </mx:source>
              </mx:XMLListCollection>
              <mx:LineChart id="lineChart" height="100%" width="100%" dataProvider="{dp}" showDataTips="true"> 
                        <mx:horizontalAxis> 
                                  <mx:CategoryAxis categoryField="name"/> 
                        </mx:horizontalAxis> 
                        <mx:series> 
                                  <mx:LineSeries yField="v1" form="curve" displayName="v1"/>
                        </mx:series> 
              </mx:LineChart> 
              <mx:Legend dataProvider="{lineChart}" direction="horizontal"/>
              <mx:LineChart id="lineChart2" height="100%" width="100%" dataProvider="{dp2}" showDataTips="true"> 
                        <mx:horizontalAxis> 
                                  <mx:CategoryAxis categoryField="@name"/> 
                        </mx:horizontalAxis> 
                        <mx:series> 
                                  <mx:LineSeries yField="@v1" form="curve" displayName="v1"/>
                        </mx:series> 
              </mx:LineChart> 
              <mx:Legend dataProvider="{lineChart2}" direction="horizontal"/>
    </mx:Application>

    Define a default value to v1 for each of your objects in the ArrayCollection, or even better, use a strongly typed model class. In XML this would resolve to null (or maybe an empty string?), but an object will throw a "property not found" error, which may have unexpected results (as seen above).

  • Multiple fields from array in one colum

    hi there,
    have started working in Flex 4 and quite enjoying it, I'm a designer with years of background in HTML-CSS and decided to shift to Flex.
    While testing on a DataGrid with an ArrayCollection as a data provider, I have a firstName and LastName item in my array, is it possible to display it as one column in my DataGrid, what I did to display just both item from the array is
    <mx:DataGridColumn headerText="Name" dataField="firstName" />
    <mx:DataGridColumn headerText="Name" dataField="lastName" />
    my Array is defined in the Script block..
    would appreciate any help from you guys!

    Create a custom label function which returns a concatenated firstName and lastName:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script>
            <![CDATA[
                protected function displayFullName(item:Object, col:DataGridColumn):String {
                    return item.firstName + " " + item.lastName;
            ]]>
        </mx:Script>
        <mx:DataGrid>
            <mx:columns>
                <mx:DataGridColumn dataField="firstName" />
                <mx:DataGridColumn dataField="lastName" />
                <mx:DataGridColumn labelFunction="displayFullName" headerText="full name" />
            </mx:columns>
            <mx:dataProvider>
                <mx:ArrayCollection>
                    <mx:Object firstName="Xander" lastName="Crews" />
                    <mx:Object firstName="Wendell" lastName="Stamps" />
                    <mx:Object firstName="Grace" lastName="Ryan" />
                    <mx:Object firstName="Arthur" lastName="Watley" />
                </mx:ArrayCollection>
            </mx:dataProvider>
        </mx:DataGrid>
    </mx:Application>
    Peter

  • XML as dataProvider for Charts

         I want to display XML exported from Oracle Database as a chart......
    The xml has the following structure :
    <ROWSET>
          <ROW>
                <ORDER_ITEMS_ID>1</ORDER_ITEMS_ID>
                <ORDER_ID>1</ORDER_ID>
                <PRODUCT_ID>1</PRODUCT_ID>
                <UNIT_PRICE>1200</UNIT_PRICE>
                <QUANTITY>1</QUANTITY>
          </ROW>
          <ROW>
                <ORDER_ITEMS_ID>2</ORDER_ITEMS_ID>
                <ORDER_ID>7</ORDER_ID>
                <PRODUCT_ID>1</PRODUCT_ID>
                <UNIT_PRICE>1100</UNIT_PRICE>
                <QUANTITY>3</QUANTITY>
          </ROW>
    </ROWSET>
    I've seen many chart examples using ArrayCollection as DataProvider . using the same way , i tried to set xml . But no results.
    Can you please suggest me how to set an XML as dataprovider ? ( or XMLList or XMLlistcollection )
    ( i'm developing a small app in AIR )

    Sample app from Adobe's livedocs:
    XML:
    <data>
        <result month="Jan-04">
            <apple>81768</apple>
            <orange>60310</orange>
            <banana>43357</banana>
        </result>
        <result month="Feb-04">
            <apple>81156</apple>
            <orange>58883</orange>
            <banana>49280</banana>
        </result>
    </data>
    Application:
    <?xml version="1.0"?>
    <!-- charts/XMLFileDataProvider.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Model id="results" source="../assets/data.xml"/>
      <mx:Panel title="Line Chart">
         <mx:LineChart id="myChart" dataProvider="{results.result}" showDataTips="true">
            <mx:horizontalAxis>
               <mx:CategoryAxis categoryField="month"/>
            </mx:horizontalAxis>
            <mx:series>
               <mx:LineSeries yField="banana" displayName="Banana"/>
               <mx:LineSeries yField="apple" displayName="Apple"/>
               <mx:LineSeries yField="orange" displayName="Orange"/>
            </mx:series>
         </mx:LineChart>
         <mx:Legend dataProvider="{myChart}"/>    
      </mx:Panel>
    </mx:Application>
    Tanu

  • How to refresh mx:List when the data in dataProvider is changed

    I have a mx:List that uses an ArrayCollection as a dataProvider. The ArrayCollection contains many Object, something like:
    var o:Object = new Object();
    o.label = "Apple";
    o.price = "$1.00";
    var o:Object = new Object();
    o.label = "Kiwi";
    o.price = "$0.20";
    Now the dataProvider (ArrayCollection) is updated outside the mx:List, not through the itemEditor. I want the mx:List to show the changes in the
    dataProvider (ArrayCollection), but currently it does not automatically show the changes. I could not find a refresh method in the List or dataProvider
    to force the List to reload the data. Any suggestions?

    Hi John, have you tried arrayCollection.refresh()...where arrayCollection is dataProvider for your List.
    Thanks,
    Bhasker

  • If I send ArrayCollection using HTTPService to PHP

    Is it viewed in the PHP script as an array or what???
    I am using an ArrayCollection as dataProvider for DataGrid
    and need to send back to my PHP script after mods.

    Did you find out how to do this?

  • ItemEditEnd hell - event fires gazillion times

    Well I was making great progress with my first major flex app when I hit a wall. The last element I put in place was to enable user to edit one column in a datagrid. Before I send the changes back to a web service I thought I would confirm that it is firing correctly and passing correct values. To my surprise the event fires over and over again. I believe its something to do with the use of the accordian and multiple canvases. Sorry but this is happening on both flex 3 and 4 platforms (its worse in 4 for some reason). I have not had a chance to scale down the project and simply it so apologies if the code is lenghty.
    Any ideas how to solve this?
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   creationPolicy= "all">
        <fx:Declarations>
                <mx:WebService
                id="nwCL2"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="FetchRequestAsTableToArray"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <IncRecItems>{IncRecItems}</IncRecItems>
                        <PmyGUID>{myGUID}</PmyGUID>
                        <AgeItems>{AgeItems}</AgeItems>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            <mx:WebService
                id="nwCL3"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="FetchDirectPOAsTableToArray"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler3(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <IncRecItems>{IncRecItems}</IncRecItems>
                        <AgeItems>{AgeItems2}</AgeItems>
                        <PmyGUID>{myGUID}</PmyGUID>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            <mx:WebService
                id="nwCL4"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="FetchDirectPODELAsTableToArray"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler4(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            <mx:WebService
                id="nwCL5"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="SendMailMessage"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler5(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                        <from>
                            {from}
                        </from>
                        <recepient>
                            {recepient}
                        </recepient>
                        <bcc>
                            {bcc}
                        </bcc>
                        <cc>
                            {cc}
                        </cc>
                        <subject>
                            {subject}
                        </subject>
                        <body>
                            {myEmailBody}
                        </body>
                        <CallProc>
                            {CallProc}
                        </CallProc>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            <mx:WebService
                id="nwCL6"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="InsRecordFYPOAUD"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler6(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                        <myuserID>{myuserID}</myuserID>
                        <DocCode>{DocCode}</DocCode>
                    </mx:request>
                </mx:operation>
                <mx:operation name="DelRecordFYPOAUD"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler6(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                        <DocCode>{DocCode}</DocCode>
                    </mx:request>
                </mx:operation>
                <mx:operation name="FetchUserID"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler7(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                    </mx:request>
                </mx:operation>
                <mx:operation name="InsGUIDAudit"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler8(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.collections.IViewCursor;
                import mx.controls.Alert;
                import mx.controls.ToolTip;
                import mx.controls.dataGridClasses.DataGridColumn;
                import mx.controls.dataGridClasses.DataGridItemRenderer;
                import mx.core.mx_internal;
                import mx.events.DataGridEvent;
                import mx.events.ListEvent;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                //added after upgrading to flex 4
                import mx.core.FlexGlobals;
                import mx.controls.RichTextEditor
                //import flash.events.Event;
                [Bindable] public var IncRecItems:String;
                [Bindable] public var myGUID:String;
                [Bindable] public var myData:ArrayCollection;
                [Bindable]public var serverData:ArrayCollection; 
                [Bindable]public var serverData3:ArrayCollection;
                [Bindable]public var serverData4:ArrayCollection;
                [Bindable]public var serverData5:ArrayCollection;    
                [Bindable] public var IncRecItems3:String;
                [Bindable] public var from:String;
                [Bindable] public var recepient:String;
                [Bindable] public var bcc:String;
                [Bindable] public var cc:String;
                [Bindable] public var subject:String;
                [Bindable] public var body:String;
                [Bindable] public var CallProc:String;
                [Bindable] public var myEmailBody:String;
                [Bindable] public var myuserID:String;
                [Bindable] public var DocCode:String;
                [Bindable] public var AgeItems:String;
                [Bindable] public var AgeItems2:String;
                [Bindable] public var DocItem:Number;
                [Bindable] public var DocText:String;
                //this adds event listener for mouse over event so I can display descriptive text about various columns values
                //POFromRequest.addEventListener(ListEvent.ITEM_ROLL_OVER, declarePosition);
                //USE ROLLOVER VERSUS MOUSEOVER EVENT AS THE LATTER CAUSES BLINKING
                private function createToolTip(event:ListEvent):void {
                //var col:DataGridColumn = POFromRequest.columns[event.columnIndex];
                //var newValue:String = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                //Alert.show("You are hovering over:" +newValue);
                if (event.columnIndex==13)
                var str:String =  "P-Y=Paid and Completed" + "\r"  + "O-Y=Open and Completed" + "\r"  + "O-R=Open and Unmatched" ;
                //this code works and will fetch active mouse over datagrid values!           
                var col:DataGridColumn = POFromRequest.columns[event.columnIndex];
                var newValue:String = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                //Alert.show("You are hovering over:" +newValue);
                else if (event.columnIndex==21||event.columnIndex==22)
                var col21:DataGridColumn = POFromRequest.columns[21];
                var col22:DataGridColumn = POFromRequest.columns[22];
                var Value21:Number = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col21.dataField];
                var Value22:Number = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col22.dataField];
                //21=Bal not Rec(BNR);22=Bal not Inv(BNI)
                //evaluate BNR/BNI and give approp message which represents
                //action required by end user (ie they don't have to think!)
                var str:String
                if (Value21>0 && Value22<=0)
                str = "Case1:All invoices sent to AP but we are missing a receiving. Please contact receiving.";
                else if(Value21>0 && Value22>0)
                str = "Case2:We are missing invoices and receiving. Please contact both departments ASAP.";
                else if(Value21<=0 && Value22>0)
                str = "Case3:All receiving completed but we are missing invoices. Please contact AP and forward any invoices to them ASAP.";
                else if(Value21==0 && Value22==0)
                str = "Case4:All documents received. No action required. You can hide these items by clicking/turning off the box:Include Balance of 0 Items? ";
                //var str:String = Value21.toString()+Value22.toString()
                else
                //var str:String = "Row :"  +event.rowIndex + "Column : " +event.columnIndex;
                POFromRequest.toolTip = str;
                private function deleteToolTip(obj:Object):void {
                POFromRequest.toolTip = null;
                //start mouse over code for directPO datagrid
                private function createToolTip2(event:ListEvent):void {
                //var col:DataGridColumn = DirectPOGrid.columns[event.columnIndex];
                //var newValue:String = ArrayCollection(DirectPOGrid.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                //Alert.show("You are hovering over:" +newValue);
                if (event.columnIndex==1)
                var str:String =  "If you know for sure that this item is not yours then highlight item by left clicking, then hit the delete button below. Hold the ctrl key to select multiple items." ;               
                if (event.columnIndex==12)
                var str:String =  "P-Y=Paid and Completed" + "\r"  + "O-Y=Open and Completed" + "\r"  + "O-R=Open and Unmatched" ;
                //this code works and will fetch active mouse over datagrid values!           
                var col:DataGridColumn = DirectPOGrid.columns[event.columnIndex];
                var newValue:String = ArrayCollection(DirectPOGrid.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                //Alert.show("You are hovering over:" +newValue);
                else if (event.columnIndex==20||event.columnIndex==21)
                var col20:DataGridColumn = DirectPOGrid.columns[20];
                var col21:DataGridColumn = DirectPOGrid.columns[21];
                var Value20:Number = ArrayCollection(DirectPOGrid.dataProvider).getItemAt(event.rowIndex)[col20.dataField];
                var Value21:Number = ArrayCollection(DirectPOGrid.dataProvider).getItemAt(event.rowIndex)[col21.dataField];
                //21=Bal not Rec(BNR);22=Bal not Inv(BNI)
                //evaluate BNR/BNI and give approp message which represents
                //action required by end user (ie they don't have to think!)
                var str:String
                if (Value20>0 && Value21<=0)
                str = "Case1:All invoices sent to AP but we are missing a receiving. Please contact receiving.";
                else if(Value20>0 && Value21>0)
                str = "Case2:We are missing invoices and receiving. Please contact both departments ASAP.";
                else if(Value20<=0 && Value21>0)
                str = "Case3:All receiving completed but we are missing invoices. Please contact AP and forward any invoices to them ASAP.";
                else if(Value20==0 && Value21==0)
                str = "Case4:All documents received. No action required. You can hide these items by clicking/turning off the box:Include Balance of 0 Items? ";
                //var str:String = Value21.toString()+Value22.toString()
                else
                //var str:String = "Row :"  +event.rowIndex + "Column : " +event.columnIndex;
                DirectPOGrid.toolTip = str;
                private function deleteToolTip2(obj:Object):void {
                DirectPOGrid.toolTip = null;
                //end tool tip code
                private function GetData():void
                //IncRecItems = "Y"
                //IncRecItems = "Y"
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                //var MyurlParams:Dictionary = new Dictionary();
                //MyurlParams = getUrlParamaters();
                //myGUID = MyurlParams['myGUID'];
                nwCL2.FetchRequestAsTableToArray.send();
                private function GetData3():void
                //IncRecItems = "Y"
                //IncRecItems = "Y"
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                var MyurlParams:Dictionary = new Dictionary();
                MyurlParams = getUrlParamaters();
                myGUID = MyurlParams['myGUID'];
                nwCL3.FetchDirectPOAsTableToArray.send();
                NotifyDel();
                private function GetData4():void
                //IncRecItems = "Y"
                //IncRecItems = "Y"
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                var MyurlParams:Dictionary = new Dictionary();
                MyurlParams = getUrlParamaters();
                myGUID = MyurlParams['myGUID'];
                nwCL4.FetchDirectPODELAsTableToArray.send();
                NotifyStatus();
                public function resultHandler(event:ResultEvent):void {
                serverData = new ArrayCollection(event.result.source);
                //             Alert.show("getdata fired");
                public function resultHandler3(event:ResultEvent):void {
                serverData3 = new ArrayCollection(event.result.source);
                //             Alert.show("getdata fired");
                public function resultHandler4(event:ResultEvent):void {
                serverData4 = new ArrayCollection(event.result.source);
                //             Alert.show("getdata fired");
                public function resultHandler5(event:ResultEvent):void {
                var FunctionResult:String=event.result.toString();
                var Response:String;
                if(FunctionResult != "Success")
                Alert.show("A problem has occurred. " + FunctionResult);
                else
                Alert.show("The email was sent successfully.");
                //             Alert.show("getdata fired");
                public function resultHandler6(event:ResultEvent):void {
                var FunctionResult:String=event.result.toString();
                var Response:String;
                if(FunctionResult != "Success")
                Alert.show("A problem has occurred. " + FunctionResult);
                else
                Alert.show("Item moved.");
                //refresh both datagrids for deleted/ins records
                //need to call diff proc which does the same but does not show the initial message box
                ReloadTables()
                public function resultHandler7(event:ResultEvent):void {
                var FunctionResult:String=event.result.toString();
                if(FunctionResult == "Invalid GUID")
                Alert.show("A problem has occurred. " + FunctionResult);
                else
                myuserID = FunctionResult;
                myGlobVar.globMyUserID = FunctionResult;
                public function resultHandler8(event:ResultEvent):void {
                //we don't really care about handling this event
                var FunctionResult:String=event.result.toString();
                if(FunctionResult == "Invalid GUID")
                Alert.show("A problem has occurred. " + FunctionResult);
                else
                //myuserID = FunctionResult;
                private function initApp():void
                //code for grabing guid passed from .net ldap authentication page
                //this file is located on finance-web box along with guid database.
                //the web service is also located on finance-web
                //and flex source code is on box fin-selement3 but is saved to U and published to finance-web
                //(this is because flex is installed on fin-selement3 only
                //GurfeedTbl = nwCL.FetchFTVACCTAsTable();
                flash.system.Security.allowDomain("*");flash.system.Security.allowInsecureDomain("*");
                //siteData.send();
                //trace("Hello from Flex Debugging!");
                //Alert.show("Init app fired");
                //first get focus of email tab (if we don't then a bug exists;error on object creation)
                //I have tried various techniques for some reason I can't load back to base 0
                //ac.selectedIndex = 3;
                //Alert.show("Please remember to audit documents on all tabssss!");
                //ac.selectedIndex = 1;
                Alert.show("HardCoded GUID in place. Remove after testing")
                myGUID = "c25ef14a-bff4-4e07-bfa5-f9c0725c3fd0";
                //need to set initial value
                AgeItems = "N";
                AgeItems2 = "N";
                myBody.text = "Body";
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                //var MyurlParams:Dictionary = new Dictionary();
                //MyurlParams = getUrlParamaters();
                //myGUID = MyurlParams['myGUID'];
                //Alert.show("HardCoded GUID in place. Remove after testing")
                //myGUID = "c25ef14a-bff4-4e07-bfa5-f9c0725c3fd0";
                //insert audit trail record
                nwCL6.InsGUIDAudit.send();
                nwCL6.FetchUserID.send(); //for some reason when this was located inside the proc it was called from it would not
                //set the global variable until after it was required resulting in null error
                //myGlobVar.globMyUserID = myUserID ;
                //Alert.show
                private function checkBoxZero_change(evt:Event):void {
                if(checkBoxZero.selected == true) IncRecItems = "Y" else IncRecItems ="N";
                //Alert.show(IncRecItems.toString())
                GetData() ;
                private function checkBoxAge_change(evt:Event):void {
                //if(checkBoxAge.selected == true) AgeItems = "Y" else AgeItems ="N";
                if(checkBoxAge.selected == true) AgeItems = "N" else AgeItems ="Y";
                GetData() ;
                private function checkBoxAge2_change(evt:Event):void {
                //if(checkBoxAge.selected == true) AgeItems = "Y" else AgeItems ="N";
                if(checkBoxAge2.selected == true) AgeItems2 = "N" else AgeItems2 ="Y";
                GetData3() ;
                private function checkBoxZero3_change(evt:Event):void {
                if(checkBoxZero3.selected == true) IncRecItems3 = "Y" else IncRecItems3 ="N";
                //Alert.show(IncRecItems.toString())
                GetData3() ;
                private function onFault(event:FaultEvent):void {
                Alert.show(event.fault.toString());
                private function RemoveItems():void {
                var selectedItems:Array = DirectPOGrid.selectedItems;
                var listItem:Object;
                if (selectedItems.length < 1)
                Alert.show("You did not highlight any items. Highlight items by left clicking the mouse. To select multiple items, hold the ctrl key down while left clicking.");
                //nwCL6.FetchUserID.send();
                for (var i:int = 0; i < selectedItems.length; i++)
                listItem = selectedItems[i];
                //DirectPOGrid.removeItem(listItem);
                //TargetList.addItem(listItem);
                //var newValue:String = ArrayCollection("selectedItems").getItemAt(i)["PO"];
                var newValue:String = listItem["PO"].toString()
                //Alert.show(newValue);
                DocCode = listItem["PO"].toString()
                //call proc to set userid was not working here as it was getting fired after so I moved it to initapp
                //nwCL6.FetchUserID.send();
                myuserID = myGlobVar.globMyUserID;
                //myUserID = 'testuser';
                nwCL6.InsRecordFYPOAUD.send();
                //Alert.show("doc:"+DocCode+" guid:"+myGUID+"user:"+myGlobVar.globMyUserID);
                //Alert.show(selectedItems[i][PO].toString());
                private function RemoveItems4():void {
                var selectedItems:Array = DirectPOGridNotMine.selectedItems;
                var listItem:Object;
                if (selectedItems.length < 1)
                Alert.show("You did not highlight any items. Highlight items by left clicking the mouse. To select multiple items, hold the ctrl key down while left clicking.");
                for (var i:int = 0; i < selectedItems.length; i++)
                listItem = selectedItems[i];
                //DirectPOGrid.removeItem(listItem);
                //TargetList.addItem(listItem);
                //var newValue:String = ArrayCollection("selectedItems").getItemAt(i)["PO"];
                var newValue:String = listItem["PO"].toString()
                //Alert.show(newValue);
                //Alert.show(selectedItems[i][PO].toString());
                DocCode = listItem["PO"].toString()
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                nwCL6.DelRecordFYPOAUD.send();
                private function NotifyDel():void {
                Alert.show("These PO's were not created from requests and we are only guessing that they might belong to you. If you don't want to see specific PO's then you can remove them. This is done by highlighting items (left clicking on row), then clicking the delete button below. Hold the ctrl key to select multiple items.") ;   
                private function NotifyStatus():void {
                Alert.show("These PO's were not created from requests and are displayed here because you have marked them as not belonging to you. If you have accidentally deleted these and they really belong to you then hit the delete button below to reactivate them.") ;   
                private function POSendEmailAP():void {
                var selectedItems:Array = POFromRequest.selectedItems;
                var listItem:Object;
                var newValue:String;
                var ValEmailTO:String = "[email protected],[email protected]";
                var myString:String;
                var txtBody:String;
                var num:int;
                if (selectedItems.length < 1)
                Alert.show("You did not highlight any items. Highlight items by left clicking the mouse. To select multiple items, hold the ctrl key down while left clicking.");
                // emailTO.text = ValEmailTO ;
                txtBody = myBody.text.toString()
                for (var i:int = 0; i < selectedItems.length; i++)
                listItem = selectedItems[i];
                //DirectPOGrid.removeItem(listItem);
                //TargetList.addItem(listItem);
                //var newValue:String = ArrayCollection("selectedItems").getItemAt(i)["PO"];
                newValue = listItem["PO"].toString();
                //Alert.show(newValue);
                emailTO.text = ValEmailTO;
                if (emailSUBJECT.text.toString()=="subject")
                emailSUBJECT.text = newValue ;   
                else
                if (emailSUBJECT.text.indexOf(newValue,0)<0)//this ensures that we only show distinct PO values
                emailSUBJECT.text = emailSUBJECT.text.toString()+"/"+newValue ;   
                //code for email body
                if (txtBody=="Body")
                txtBody = "Dear AP/Receiving:" + "\r" + "\r" + "Please note that I have received the following items directly from the vendor(s): " + "\r" + "\r" + listItem["PO"].toString() + " POItem:" + listItem["POItem"].toString() + " " + listItem["CMDDESC"].toString()  + " " + "QTYRCVD:" + listItem["BALNOTRECD"].toString() + " ";
                else
                txtBody = txtBody + "\r" + listItem["PO"].toString() + " POItem:" + listItem["POItem"].toString() + " " + listItem["CMDDESC"].toString()  + " " + "QTYRCVD:" + listItem["BALNOTRECD"].toString() + " ";   
                myBody.text = txtBody;
                //public variable for sending body text to email service in correct format
                //body = txtBody;
                Alert.show("Items copied to email tab.");
                POFromRequest.selectedIndex=-1;
                private function POSendEmailAPDirectStuff():void {
                var selectedItems:Array = DirectPOGrid.selectedItems;
                var listItem:Object;
                var newValue:String;
                var ValEmailTO:String = "[email protected],[email protected]";
                var myString:String;
                var txtBody:String;
                if (selectedItems.length < 1)
                Alert.show("You did not highlight any items. Highlight items by left clicking the mouse. To select multiple items, hold the ctrl key down while left clicking.");
                // emailTO.text = ValEmailTO ;
                txtBody = myBody.text.toString()
                for (var i:int = 0; i < selectedItems.length; i++)
                listItem = selectedItems[i];
                //DirectPOGrid.removeItem(listItem);
                //TargetList.addItem(listItem);
                //var newValue:String = ArrayCollection("selectedItems").getItemAt(i)["PO"];
                newValue = listItem["PO"].toString();
                //Alert.show(newValue);
                emailTO.text = ValEmailTO;
                if (emailSUBJECT.text.toString()=="subject")
                emailSUBJECT.text = newValue ;   
                else
                if (emailSUBJECT.text.indexOf(newValue,0)<0)//this ensures that we only show distinct PO values
                emailSUBJECT.text = emailSUBJECT.text.toString()+"/"+newValue ;   
                //code for email body
                if (txtBody=="Body")
                txtBody = "Dear AP/Receiving:" + "\r" + "\r" + "Please note that I have received the following items directly from the vendor(s): " + "\r" + "\r" + listItem["PO"].toString() + " POItem:" + listItem["POItem"].toString() + " " + listItem["CMDDESC"].toString()  + " " + "QTYRCVD:" + listItem["BALNOTRECD"].toString() + " ";
                else
                txtBody = txtBody + "\r" + listItem["PO"].toString() + " POItem:" + listItem["POItem"].toString() + " " + listItem["CMDDESC"].toString()  + " " + "QTYRCVD:" + listItem["BALNOTRECD"].toString() + " ";   
                myBody.text = txtBody;
                Alert.show("Items copied to email tab.");
                DirectPOGrid.selectedIndex=-1;
                private function ClearEmail():void {
                myBody.text = "Body";
                emailSUBJECT.text = "Subject";
                private function SEmail():void {
                //hardcode until we fetch via guid
                //Alert.show("Insert code to fetch username from guid. For now its hard coded.");
                CallProc = "FLEX"; //This notifies web service so it parses out \r to <p>
                //from = "[email protected]"
                var MyurlParams:Dictionary = new Dictionary();
                MyurlParams = getUrlParamaters();
                myGUID = MyurlParams['myGUID'];
                //myGUID = "c25ef14a-bff4-4e07-bfa5-f9c0725c3fd0";
                //from = myuserID+"@aus.edu";
                from = myGlobVar.globMyUserID+"@aus.edu";
                recepient =  emailTO.text.toString();
                cc = emailCC.text.toString();
                bcc = "[email protected]"
                subject = emailSUBJECT.text.toString();   
                //var stuffToReplace:RegExp = /\r\n|\n\r/g;
                //the key to this function is the /g means global and means to replace ALL instances of search variable!!!
                var stuffToReplace:RegExp = /\r/g;
                //myEmailBody = myEmailBody.replace("\r","*123");
                myEmailBody = myBody.text.replace(stuffToReplace,"*123*");
                //myEmailBody = myBody.text.replace("\r","*\r").toString();
                //myEmailBody = myBody.text ;
                //myEmailBody.replace("\r","*\r");
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                nwCL5.SendMailMessage.send();
                private function ReloadTables():void
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                nwCL4.FetchDirectPODELAsTableToArray.send();
                nwCL3.FetchDirectPOAsTableToArray.send();    
                private function getUrlParamaters():Dictionary
                var urlParams:Dictionary = new Dictionary();
                if (ExternalInterface.available)
                var fullUrl:String = ExternalInterface.call('eval', 'document.location.href');
                var paramStr:String = fullUrl.split('?')[1];
                if (paramStr != null)
                var params:Array = paramStr.split('&');
                for (var i:int=0; i < params.length; i++)
                var kv:Array = params[i].split('=');
                urlParams[kv[0]] = kv[1];
                else
                    urlParams = FlexGlobals.topLevelApplication.parameters;
                //urlParams = Application.application.parameters;
                    //urlParams = sparks.components.application.parameters;
                return urlParams;
                private function RefData(event:DataGridEvent):void {
                    var dataGrid:DataGrid = event.target as DataGrid;
                    var dsColumnIndex:Number = event.columnIndex;
                    var col:DataGridColumn = dataGrid.columns[dsColumnIndex];
                    var colPO:DataGridColumn = dataGrid.columns[1];
                    var colPOItem:DataGridColumn = dataGrid.columns[5];
                    var colNotes:DataGridColumn = dataGrid.columns[23];
                    var newValue:String = dataGrid.itemEditorInstance[col.editorDataField];
                    var newValue2:String = dataGrid.itemEditorInstance[colNotes.editorDataField];   
                    var dbval:String;
                    var dbvalLen:Number;
                    DocCode = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[colPO.dataField];
                    DocItem = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[colPOItem.dataField ];
                    dbval = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                    if (dbval.length != null)
                    dbvalLen = dbval.length;
                    else
                    dbvalLen = 0;
                    //Alert.show("key=" +myGlobVar.KeyPress)
                    if (newValue2.substr(0,3)!='P00') //this is silly code that is necessary until I sort the whole problem of audit note Dec 2010
                        //When the user hits the tab key the cursor goes to the next line and for some reason assigns PO field value to notes field value
                        //this line of code ignores in that case       
                        //if (dbval==null && newValue2!=null && newValue2!='')
                        //if (newValue2!=null || newValue2!='')
                        //if (newValue2!=null || dbvalLen>=1)
                        Alert.show("grid value" +DocCode+":"+DocItem+"Notes:"+newValue+"colNotes:"+newValue2+"dbvnotes:"+dbval);                
                    //nwCL6.UpdateFYPOAUD.send();
                    //tempCnt
                    //if datagrid edit is true then this will fire       
                    //all the code below is checking if value from datagrid has changed
                    //as compared to value stored in source data so we don't need this in this project
                    //var dsFieldName:String = event.dataField;
                    //var author:VOAuthor = event.itemRenderer.data as VOAuthor;
                    //if (newValue == author[dsFieldName])
                    //    return;
                    //get the new value for the first name or last name
                    //author[dsFieldName] = newValue;
                    //myRemote.saveData(author);
            ]]>
        </fx:Script>
        <mx:Panel title="Auditing of Purchase Order Delivery and Invoicing Status by User:" height="100%" width="100%"
                  creationComplete="initApp()" paddingTop="5" paddingBottom="5" paddingLeft="5" paddingRight="5" fontSize="15" horizontalAlign="left" color="#701193">
            <mx:Accordion id="ac"
                          width="100%"
                          height="100%"
                          selectedIndex="0"
                          historyManagementEnabled="false"  >
                <mx:Canvas width="100%" height="400"  label="Detailed Data for which a PO was issued from a Request" id="POfromReq" backgroundColor="#D2E9DA" color="#A60831">
                    <mx:Button click="GetData()" label="Press to load Data" width="305"></mx:Button>
                    <mx:FormItem label="HeaderWordWrap:" x="335">
                        <mx:CheckBox id="checkBox" selected="true" />
                    </mx:FormItem>
                    <mx:FormItem label="Include Balance of 0 Items?:" x="550">
                        <mx:CheckBox id="checkBoxZero" selected="false" change="checkBoxZero_change(event);"  />
                    </mx:FormItem>
                    <mx:FormItem label="Only Show Items > 30 Days?:" x="850">
                        <mx:CheckBox id="checkBoxAge" selected="true" change="checkBoxAge_change(event);"  />
                    </mx:FormItem>
                    <mx:DataGrid id="POFromRequest"  allowMultipleSelection="true" doubleClickEnabled="true" editable="True" horizontalScrollPolicy="auto" width="3500" height="300" dataProvider="{serverData}" y="36" itemRollOut="deleteToolTip(event)" itemRollOver="createToolTip(event)" itemEditEnd="RefData(event)">
                        <mx:columns>
                            <fx:Array>
                                <mx:DataGridColumn headerText="UserName"  editable="false" dataField="SOURCEREQUESTUSERID" width="100"/>
                                <mx:DataGridColumn headerText="PO" dataField="PO" width="100"/>
                                <mx:DataGridColumn headerText="Vendor" dataField="VENDOR" width="270"/>
                                <mx:DataGridColumn headerText="Po Date" dataField="PO_Date" width="120"/>
                                <mx:DataGridColumn headerText="Ordered QTY (A)" headerWordWrap="{checkBox.selected}" dataField="Ord_Qty" width="120" />
                                <mx:DataGridColumn headerText="PO Item" dataField="POItem" width="100" />
                                <mx:DataGridColumn headerText="Commodity Description" dataField="CMDDESC" width="300"/>
                                <mx:DataGridColumn headerText="PO Unit Price" dataField="POUNITPRICE" width="120"/>
                                <mx:DataGridColumn headerText="Org code" dataField="ACTGORG" width="100"/>
                                <mx:DataGridColumn headerText="Receiving Document" dataField="RECEIVE_DOC_NUM" headerWordWrap="{checkBox.selected}" width="120"/>
                                <mx:DataGridColumn headerText="Received Qty (B)" dataField="RECQTY" width="150"/>
                                <mx:DataGridColumn headerText="Inv Document #" dataField="INVCODE" width="150"/>
                                <mx:DataGridColumn headerText="Vendor Invoice #" dataField="VENDINV" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Status" dataField="INVSTATUS" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Due Date" dataField="DUEDATE" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Date" dataField="VENDORINVDATE" width="120"/>
                                <mx:DataGridColumn headerText="Fund" dataField="FUNDCODE" width="80"/>
                                <mx:DataGridColumn headerText="Account" dataField="ACCT" width="80"/>
                                <mx:DataGridColumn headerText="Org" dataField="ORG" width="80"/>
                                <mx:DataGridColumn headerText="Prg" dataField="PROG" width="80"/>
                                <mx:DataGridColumn headerText="Net Invoiced (C)" headerWordWrap="{checkBox.selected}" dataField="NETINVD" width="130"/>
                                <mx:DataGridColumn headerText="Balance not Received (A-B)" headerWordWrap="{checkBox.selected}" dataField="BALNOTRECD" width="175"/>
                                <mx:DataGridColumn headerText="Balance not Invoiced (B-C)" headerWordWrap="{checkBox.selected}" dataField="BALNOTINVD" width="175"/>
                                <mx:DataGridColumn headerText="Notes" headerWordWrap="{checkBox.selected}" dataField="NOTES" width="300"/>
                            </fx:Array>
                        </mx:columns>
                    </mx:DataGrid>
                    <mx:List id="square"  visible="false" x="298" y="266"></mx:List>
                    <mx:Button click="POSendEmailAP()" label="Press to copy selected items to body of email template" width="478" y="344"></mx:Button>
                </mx:Canvas>
                <mx:Canvas width="100%" height="400"  label="Direct PO Details: PO not created from request" id="DirectPO" backgroundColor="#D2E9DA" color="#A60831">
                    <mx:Button click="GetData3()" label="Press to load Data" width="305"></mx:Button>
                    <mx:FormItem label="HeaderWordWrap:" x="335">
                        <mx:CheckBox id="checkBox3" selected="true" />
                    </mx:FormItem>
                    <mx:FormItem label="Include Balance of 0 Items?:" x="550">
                        <mx:CheckBox id="checkBoxZero3" selected="false" change="checkBoxZero3_change(event);"  />
                    </mx:FormItem>
                    <mx:FormItem label="Only Show Items > 30 Days?:" x="850">
                        <mx:CheckBox id="checkBoxAge2" selected="true" change="checkBoxAge2_change(event);"  />
                    </mx:FormItem>
                    <mx:DataGrid id="DirectPOGrid"  allowMultipleSelection="true" horizontalScrollPolicy="auto" width="3500" height="300" dataProvider="{serverData3}" y="36" itemRollOut="deleteToolTip2(event)" itemRollOver="createToolTip2(event)" itemEditEnd="RefData(event)">
                        <mx:columns>
                            <fx:Array>
                                <mx:DataGridColumn  headerText="PossibleUserName" dataField="PossibleSourceUserid" width="160"/>
                                <mx:DataGridColumn headerText="PO" dataField="PO" width="100"/>
                                <mx:DataGridColumn headerText="Vendor" dataField="VENDOR" width="270"/>
                                <mx:DataGridColumn headerText="Po Date" dataField="PO_Date" width="120"/>
                                <mx:DataGridColumn headerText="Ordered QTY (A)" headerWordWrap="{checkBox3.selected}" dataField="Ord_Qty" width="120" />
                                <mx:DataGridColumn headerText="PO Item" dataField="POItem" width="100" />
                                <mx:DataGridColumn headerText="Commodity Description" dataField="CMDDESC" width="300"/>
                                <mx:DataGridColumn headerText="PO Unit Price" dataField="POUNITPRICE" width="120"/>
                                <mx:DataGridColumn headerText="Org code" dataField="ACTGORG" width="100"/>
                                <mx:DataGridColumn headerText="Received Qty (B)" dataField="RECQTY" width="150"/>
                                <mx:DataGridColumn headerText="Inv Document #" dataField="INVCODE" width="150"/>
                                <mx:DataGridColumn headerText="Vendor Invoice #" dataField="VENDINV" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Status" dataField="INVSTATUS" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Due Date" dataField="DUEDATE" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Date" dataField="VENDORINVDATE" width="120"/>
                                <mx:DataGridColumn headerText="Fund" dataField="FUNDCODE" width="80"/>
                                <mx:DataGridColumn headerText="Account" dataField="ACCT" width="80"/>
                                <mx:DataGridColumn headerText="Org" dataField="ORG

    Thanks...I was using Alert instead of trace to make sure events were firing along with correct parameter values before calling web service. I never thought in a million years that would be causing the problem. However, when user hits return it drops the focus to the next row which causes a second itemEditEnd to fire (so it still doesn't work smoothly). At any rate, I approached it another way by wiring up a pop up box.

  • Skinning selected DataGrid header in Flex 4

    Hi,
    What I'm trying to do seems trivial, but after hours of searching for historical clues I have still not achieved it. I simply want to reskin only the selected header. There seems to be multiple approaches:
    1) define a custom headerRenderer - but this ends up with the sort indicator cobbled on top of your custom drawn area
    2) rework the header background skin to clip/draw the selected column differently - but this requires clipping to the selected column, and figuring out the dimensions to clip to
    Am I missing an obvious and easier solution?  Any examples out there?
    Thanks!

    Thanks again Alex.
    I managed to achieve something satisfactory with the following custom HeaderRenderer. The negative padding on the right side allows the gradient to extend underneath the sort skin to fill the entire column. This seemed easier (if not cleaner) than also skinning the sort arrow skin in the same way.
    I also had to extend DataGridHeader and override drawHeaderIndicator (for the rollover of the column header) and drawSelectionIndicator (for the transitionary state of clicking on the column header before the sort takes effect).
    Still a work in progress, but hopefully this will save the next Googler some time in achieving any of these goals.  And of course I welcome any refinements or any admonishments that I'm doing something really stupid.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group> 
    implements="mx.controls.listClasses.IListItemRenderer"xmlns:fx="
    http://ns.adobe.com/mxml/2009" xmlns:s="
    library://ns.adobe.com/flex/spark" xmlns:mx="
    library://ns.adobe.com/flex/halo"width="
    100%" height="100%">
    <fx:Script>
    <![CDATA[
    import com.company.player.model.Constants; 
    import mx.collections.ArrayCollection; 
    import mx.controls.DataGrid; 
    import mx.controls.dataGridClasses.DataGridColumn; 
    import mx.controls.listClasses.IListItemRenderer; 
    import mx.controls.listClasses.ListBase; 
    private var _data:Object; 
    static private const LABEL_BUFFER:int = 4; 
    static private const SORT_INDICATOR_WIDTH:int = 14; 
    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    var owner:DataGrid = owner as DataGrid; 
    var col:DataGridColumn = data as DataGridColumn; 
    var bSorted:Boolean = false; 
    var ac:ArrayCollection = owner.dataProvider as ArrayCollection; 
    if (ac && ac.sort){
    // there's a sort in place - is it on this column?
    var sortFieldName:String = ac.sort.fields[0].name; 
    bSorted = (sortFieldName == col.dataField);
    gradientOverlay.alpha = bSorted ? 1 : 0;
    gradientOverlay.visible = bSorted;
    lbl.width = col.width - LABEL_BUFFER - (bSorted ? SORT_INDICATOR_WIDTH : 0);
    lbl.text = col.headerText;
    lbl.setStyle(
    "color", bSorted ? "#343434" : "#767676"); 
    super.updateDisplayList(unscaledWidth, unscaledHeight);}
    ]]>
    </fx:Script>
    <s:HGroup id="gradientOverlay" width="100%" height="100%" paddingTop="-2" paddingRight="{-SORT_INDICATOR_WIDTH}" >
    <s:Rect width="100%" height="100%" >
    <s:fill>
    <s:LinearGradient rotation="90">
    <s:GradientEntry color="{Constants.SELECTION_GRADIENT1}" alpha="1"/>
    <s:GradientEntry color="{Constants.SELECTION_GRADIENT2}" alpha="1"/>
    </s:LinearGradient>  
    </s:fill>
    </s:Rect>  
    </s:HGroup>
    <s:HGroup width="100%" height="100%" verticalAlign="middle" paddingLeft="{LABEL_BUFFER}" >
    <s:Label id="lbl" maxDisplayedLines="1" showTruncationTip="true" />  
    </s:HGroup>
    </s:Group>

  • Skip row in datagrid

    Is it possible to skip a row in a datagrid that uses an
    ArrayCollection as dataprovider ?
    I want to check if an arraycollection item contains X and if
    so then don't draw it.
    I use the same arraycollection in multiple datagrids and its
    only one of them I don't want to draw the specific item.

    "geiryt" <[email protected]> wrote in
    message
    news:g7v61v$q8h$[email protected]..
    > Is it possible to skip a row in a datagrid that uses an
    ArrayCollection as
    > dataprovider ?
    > I want to check if an arraycollection item contains X
    and if so then don't
    > draw it.
    > I use the same arraycollection in multiple datagrids and
    its only one of
    > them
    > I don't want to draw the specific item.
    Use a different ArrayCollection and the same source but a
    different
    filterFunction

  • Help: Sending HTTPService request using POST to a php script

    Hello all,
    I need help in learning the proper method of communicating to php scripts from flex 3. I am very new to flex 3, php and web development. Thanks!
    What I am trying to do is as follows:
    1. User drags and drops a few items in a list control
    2. user clicks a button to send these keywords to server php script
    3. server will form a query based on the words sent and retrieve records and send them back
    Here is what I have done so far:
    1. When I send a request to server without any parameters, I amable to receive the request and query the database and send results in xml format
    current issues I am facing:
    1. I am gathering the list of entries in list control as follows:
    <*** this function is callled when user decides to send request to server ***>private function startsearch():void {
       var i:int;
       var myAC:ArrayCollection = ArrayCollection(SelCtypes_id.dataProvider);
       var nct:XML = new XML("<contenttypes></contenttypes>");
       // add contenttype child now
       for (i = 0; i<myAC.length; i++) {
        nct.appendChild(XML(<contenttype>{myAC[i].toString()}</contenttype>));
       var params:Object = new Object();
       params.contenttypes = nct.toXMLString();
       getsearchresults.send(params);
    <*** my http service entry****>
      <mx:HTTPService id="getsearchresults"
       method="post"
      url="http://localhost/search_xml.php"
      result="handlesearchresultsXml(event)"
      contentType="application/xml" />
    This is what I see in flex debugger just when the request is sent out:
    -> just before gersearchresults.send(params) call:
    params.contenttypes = "<contenttypes>
      <contenttype>AVI</contenttype>
      <contenttype>SWF</contenttype>
    </contenttypes>"
    <*** within the HTTPrequest send function, I see th following in debugger ***>
    message.contentType="application/xml"
    message.body = paramsToSend shows "<contenttypes>&lt;contenttypes&gt;
    &lt;contenttype&gt;AVI&lt;/contenttype&gt;
    &lt;contenttype&gt;SWF&lt;/contenttype&gt;
    &lt;/contenttypes&gt;</contenttypes>"
    This looks like my XML object is again formatted by an out <contenttypes> tag and the string is converted to be HTML safe (i.e. &lt, &gt notation).
    It looks like I am not doing something right with my params formation to XML and HTTPservice is reformatting it to be some form of XML (I do not know XML well either :-)
    My questions:
    1. What am I doing wrong?
    2. If there is a good example where I can send multiple parameters from flex client to php server and get data back where the request parameters will beof the form...
    <query>
    <type1>
         <type1val>value1</type1val>
         <type1val>value2</type1val>
    </type1>
    <type2>
         <type2val>value3</type2val>
         <type2val>value4</type2val>
    </type2>
    </query>
    Thanks for your help!

    Hi, I'm having a problem with a similiar issue :/
    I'm getting the error #1010 (A term is undefined and has no properties):
    at flexGraph/httpResultHandlerUserInfo()
    at flexGraph/__userInfoXML_result()
    etc.
    I removed some parts of the code so it's easier to read, if you can help me. I'm trying to populate a datagrid with info from a database, according to the alias I choose in the ComboBox. I get the error when I pick an alias from the ComboBox.
    <mx:Script>
         <![CDATA[
         import mx.collections.ArrayCollection;
         import mx.rpc.events.FaultEvent;
         import mx.rpc.events.ResultEvent;
         import mx.events.DropdownEvent;
         [Bindable] private var usersInfo:ArrayCollection;
         private function httpResultHandlerUserInfo(event:ResultEvent):void{
              usersInfo = event.result.users.user;
         private function chooseUserCB(event:DropdownEvent):void{
              userInfoXML.send();
    ]]>
    <mx:HTTPService id="userInfoXML" url="http://www.mysecondplace.org/flex/userInfo.php"
    result="httpResultHandlerUserInfo(event)"
    useProxy="false" method="POST">
    <mx:request xmlns=""><alias>{usersAliasCB.selectedItem.alias}</alias></mx:request>
    </mx:HTTPService>
    <mx:ComboBox id="usersAliasCB"
    x="10" y="10"
    labelField="alias"
    close="chooseUserCB(event)"/>
    <mx:DataGrid id="testing"
    x="10" y="100"
    dataProvider="{usersInfo}"/>
    Here's an example from the PHP file:
    $query_user = "SELECT * FROM users WHERE alias='.$_POST["alias"].'";
    Help me please

Maybe you are looking for

  • Efi update 2.5 does not apply

    I cannot apply the MacBook Pro EFI update 2.5, and now the SMC update. The updater tells me they are available, but after restarting, I see they have not been applied, and the updater agrees, and tells me they are still available. When the computer r

  • CSS Float Problems

    I'm just becoming comfortable with using CSS. At least, I thought I was. I put together a test page and it worked on IE 7. Then, I downloaded Firefox and Safari to check compatability on other browsers. I have a centered page with a top navigation ba

  • Month End Procedures

    What is the procedure in month end?How do we do month procedures?can anybody give me some examples in month end procedure?

  • Creating Logout button and invalidating session

    Hello All: I'm new to java and I'm trying to figure out how to log a user out of a web servlet. Basically I just have a link that returns the user to the first servlet (my login servlet) called log out. I am wondering if when I click on that link (or

  • How to change dragged value

    Hi. How can I modify value of dragged String. I want add '/*' before string and '*/' after string. Any ideas?