DataGrids, ArrayCollections, Ohh My

Hello, I am new to flex and Actionscript, and have been
working with flex 3 with as3. I am using the flex builder 3 beta 1.
I have only been working with in this environment for only about a
month so please be patient. I do have experience in ColdFusion,
MYSQL, and basic web technologies such as CSS, HTML, a little JS.
So here is my problem.
my current project is a custom CMS - being Customer
Management Softeware.
<mx:RemoteObject id="customer_RO" destination="ColdFusion"
source="cms.cfc.customerConnection">
<mx:method name="getCustomers"
result="customerHandler(event)"/>
<mx:method name="getContacts"
result="contactHandler(event)"/>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
/* Creates Bindable Array variable for the Customer List */
[Bindable]
private var CustomerList:ArrayCollection;
[Bindable]
private var ContactList:ArrayCollection;
/* Creates an application initialization to load before
application loaded */
private function initApp():void
customer_RO.getCustomers();
customer_RO.getContacts();
/* Created data handlers for the remoteObject method */
private function customerHandler(event:ResultEvent):void
CustomerList = ArrayCollection(event.result);
private function contactHandler(event:ResultEvent):void
ContactList = ArrayCollection(event.result);
]]>
</mx:Script>
Now here are my data grids.
<mx:DataGrid id="dg1" x="0" y="0" width="100%"
height="100%" dataProvider="{CustomerList}">
<mx:columns>
<mx:DataGridColumn headerText="Name"
dataField="companyname" width="250"/>
<mx:DataGridColumn headerText="Address"
dataField="street1"/>
<mx:DataGridColumn headerText="City" dataField="city"
width="100"/>
<mx:DataGridColumn headerText="State"
dataField="statecode" width="50"/>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid x="0" y="0" width="100%" height="100%"
dataProvider="{ContactList}">
<mx:columns>
<mx:DataGridColumn headerText="Name"
dataField="firstname" width="150"/>
<mx:DataGridColumn headerText="Email" dataField="address"
width="175"/>
<mx:DataGridColumn headerText="Phone"
dataField="phonenumber" width="175"/>
</mx:columns>
</mx:DataGrid>

Hi,
I think you have to try following code.
private function customerHandler(event:ResultEvent):void
var dataArray:Array = new Array();
dataArray = event.result as Array;
CustomerList = new ArrayCollection(dataArray);
This will work for you cose i have faced same problem It
solved my problem.
thanks,
Megha

Similar Messages

  • Datagrid ArrayCollection Timeout issue

    Has anyone else encountered this? I'm trying to populate a datagrid with a large amount of data (approx. 1800+ records). Using a ColdFusion backend, the RemoteObject executes the CFC to generate the SELECT statement, which takes approx. 20 seconds to finish execution.
    After this, the ResultEvent is returned and bound to an ArrayCollection. However, I get a #1502 error because the script takes longer than 60 seconds to execute.
    Rather than extending the script timeout (if possible), is there any way to populate (bind) the arraycollection to the datagrid in segments?

    That is my best bet if the solution I am looking for isn't possible. Hopefully I will be able to pass the sort columns back to the query for sorting...
    Currently I'm using a pagableArrayCollection. The RO calls the CFC, which executes the query. In the result event, the event.result is bound to a "holding" ArrayCollection, then a pagablearraycollection is created from the "holding" source.
    private function getData_result(event:ResultEvent):void {
         acHold = event.result as ArrayCollection;
         acData = new PagableArrayCollection(acHold.source);
    The dataprovider is acData.
    What I want to do is bind in segments, breaking the script segment into chunks so that it will not timeout. Now I'm wondering, is it timing out on binding acHold, acData, or displaying the datagrid.
    As is, the app attempts to load all of the data at once, but only 100 records are "displayed" in the datagrid, even though all of the data is actually bound.

  • Passing a Flex object to CFC

    I have no problem passing a query object to my Flex app and
    use it to populate a datagrid (arraycollection).... however, I want
    to use this same data to update the database when the user clicks
    on save, and instead of looping through each row (calling my
    remoteobject each time) is there a way I can format this
    information into an array, array collection or some other form of
    flex object and pass ti back to another cfc function to do the
    update?????
    I've read elsewhere that its possible to do with a
    remoteobject, however, my attempts were futile and I cannot find an
    example anywhere.
    I cant find a solution anywhere so and help would be
    appreciated.

    Here is a simple example I just wrote real quick. This is how
    I normally go about passing something an array of items to
    Coldfusion. Hope this helps.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.managers.CursorManager;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    [Bindable] private var apples:Array = new Array(
    {name:"Normal Apple", color:"Red"},
    {name:"Sweet Apple", color:"Ged"},
    {name:"Rotten Apple", color:"Brown"});
    private function createApples():void {
    AppleManager.Create_Apples(apples);
    private function createApplesResult(event:ResultEvent):void
    Alert.show("You have successfully added some apples into our
    system.", "System Notice");
    ]]>
    </mx:Script>
    <mx:RemoteObject
    id="AppleManager"
    destination="ColdFusion"
    source="cfc.AppleManager"
    endpoint="Your endpoint here"
    showBusyCursor="true"
    fault="CursorManager.removeBusyCursor();Alert.show(event.fault.message,
    'System Notice')">
    <mx:method name="Create_Apples"
    result="createApplesResult(event)"/>
    </mx:RemoteObject>
    <mx:Button x="10" y="10" label="Create Apples"
    click="createApples()"/>
    <mx:DataGrid left="10" right="10" top="40" bottom="10"
    dataProvider="{apples}">
    <mx:columns>
    <mx:DataGridColumn headerText="Apple Name"
    dataField="name"/>
    <mx:DataGridColumn headerText="Apple Color"
    dataField="color"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

  • Building Flex swcs from source

    I have found a number of bugs in the DataGrid,
    ArrayCollection, LinearAxis etc that I would like to fix. Since the
    framework source is included in the SDK, it seems pretty
    straighforward to how to do this but. I would like to know which
    flex packages are in which framework swc. What is the mapping from
    mx.* space to flex.swc, charts.swc, framework.swc etc. I of course
    will report these bugs and submit my fixes too.

    This post may be outdated, but here is the solution:
    First download the source from svn:
    http://opensource.adobe.com/wiki/display/flexsdk/Get+Source+Code
    Then import and compile it:
    http://opensource.adobe.com/wiki/display/flexsdk/Build+and+Test
    I did this today and it worked fine for me, so don't hesitate if you have any questions.

  • Getting values from a datagrid to an ArrayCollection

    Hi, I have a drag and dropable datagrid. I fill it with rows of data from another datagrid. Finally, my application demands savings the data from the datagrid into an array collection along with the index of each row. How do i get values from a datagrid into an arrayCollection variable? Please help me..!

    Whatever is dropped into the DataGrid automatically goes into its dataProvider property, typically an ArrayCollection. Just access the data grid's dataProvider property to see the values.

  • How can we enter the data dynamically from datagrid to an arraycollection?

    Hi All
                        How can we make datagrid fields editable when it is in empty position i mean the datagrid doesn't have any data to display.. and it must accept the data and update the arraycollection dynamically..
                 Now in my Application the datagrid is empty and it is not accepting any values and it still remain ideal..  i am unable to edit the datagrid fields in the datagrid .....
      Please some one tell me how can i achieve this...

    Here is a very basic example.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
    <mx:Script>
      <![CDATA[
       import mx.collections.ArrayCollection;
       [Bindable] private var _dataProvider:ArrayCollection;
       private function onCreationComplete():void {
        _dataProvider = new ArrayCollection();
        for(var i:int = 1; i <= 100; ++i)
         _dataProvider.addItem({ROW:i,A:"",B:"",C:"",D:"",E:"",F:"",G:"",H:"",I:"",J:"",K:"",L:"", M:"",N:"",O:"",P:""});
      ]]>
    </mx:Script>
    <mx:Panel title="Editable DataGrid Example" height="472" width="584" horizontalCenter="0" verticalCenter="0">
      <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" dataProvider="{_dataProvider}" editable="true" horizontalScrollPolicy="on" sortableColumns="false" draggableColumns="false">
       <mx:columns>
        <mx:DataGridColumn dataField="ROW" headerText="" width="30" sortable="false" draggable="false" editable="false" paddingLeft="0" paddingRight="0" textAlign="right"/>
        <mx:DataGridColumn dataField="A" headerText="A" width="100"/>
        <mx:DataGridColumn dataField="B" headerText="B" width="100"/>
        <mx:DataGridColumn dataField="C" headerText="C" width="100"/>
        <mx:DataGridColumn dataField="D" headerText="D" width="100"/>
        <mx:DataGridColumn dataField="E" headerText="E" width="100"/>
        <mx:DataGridColumn dataField="F" headerText="F" width="100"/>
        <mx:DataGridColumn dataField="G" headerText="G" width="100"/>
        <mx:DataGridColumn dataField="H" headerText="H" width="100"/>
        <mx:DataGridColumn dataField="I" headerText="I" width="100"/>
        <mx:DataGridColumn dataField="J" headerText="J" width="100"/>
        <mx:DataGridColumn dataField="K" headerText="K" width="100"/>
        <mx:DataGridColumn dataField="L" headerText="L" width="100"/>
        <mx:DataGridColumn dataField="M" headerText="M" width="100"/>
        <mx:DataGridColumn dataField="N" headerText="N" width="100"/>
        <mx:DataGridColumn dataField="O" headerText="O" width="100"/>
        <mx:DataGridColumn dataField="P" headerText="P" width="100"/>
       </mx:columns>
      </mx:DataGrid>
    </mx:Panel>
    </mx:Application>
    Hope this helps

  • 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()

  • Problem filling DataGrid with XML - Object or ArrayCollection?

    Hi,
    I am trying to fill a datagrid with an XML file, rendered
    from a PHP
    script.
    The problem is that - first time there is only one entry in
    the XML
    file, so when I receive the data using
    event.result.root.child, I get
    an Object. But second time, when there are two entries in the
    XML
    file, the return type becomes an ArrayCollection of "child"
    type
    objects.
    This causes a problem when setting dataprovider of a
    DataGrid....
    So is there a way I can know what is the return type from the
    XML
    file, i.e., whether it is an Object or an ArrayCollection, so
    that I
    can set the dataprovider accordingly?

    In E4x
    If you have an xml structure like so:
    <parent prop1='someValue' >
    <child prop1='someValue' />
    </parent>
    to reference the parent use event.result
    to get the child use: event.result.child; to get the child
    attr: event.result.child.@prop1;

  • Edit filtered ArrayCollection messes up Datagrid

    I understand Datagrid + itemrenderer is a frustrating issue
    sometimes. After Googling around, I got no luck solving my problem.
    It goes like this:
    I have an ArrayCollection
    objectArray as the dataprovider for a datagrid. I applied a
    filtered function on
    objectArray and the datagrid displayed the filtered array
    with no problem. However, when I looped through the filtered array
    and made some changes, the datagrid went crazy. The order got
    changed and some of the changed values didn't show up as changed.
    Did anyone come across the same issue? Can anyone give me
    some idea of what's going on?
    Thanks.

    mmm...
    Filter should be working, lets try to change Item for object.
    private function changeValue():void {
    for each (var item:Object in myArray) {
    item.value = true;
    myArray.refresh();
    "scabbage" <[email protected]> wrote in
    message
    news:[email protected]...
    > Ok, I think I found where the problem is. My code looks
    like this:
    >
    >
    >
    > ----------
    > <mx:Script>
    > <![CDATA[
    >
    > private function applyFilter():void {
    > myArray.filterFunction = myFilter;
    > myArray.refresh();
    > }
    >
    > private function changeValue():void {
    > for each (var item:Item in myArray) {
    > item.value = true;
    > }
    > myArray.refresh();
    > }
    >
    >
    > // simple filter
    > private function myFilter(item:Object):void {
    > if (item.id > 5 && item.id < 20)
    > return true;
    > else
    > return false;
    > }
    >
    > ]]>
    > </mx:Script>
    >
    > <mx:DataGrid dataProvider="{myArray}"/>
    > <mx:Button label="filter" click="applyFilter()"/>
    > <mx:Button label="change value"
    click="changeValue()"/>
    >
    >
    >
    > -------------------------
    >
    > So what causes the problem is the "changeValue"
    function. Solution to my
    > problem: bring "myArray.refresh()" inside the loop. So
    instead of doing a
    > refresh after all the values are changed, refresh the
    array EVERY TIME you
    > change a value. I realized that without doing this, the
    "for each" loop
    > doesn't
    > loop through the filtered array correctly. Some items
    gets accessed twice
    > and
    > some don't get accessed at all. This explains the "true,
    false, true,
    > false,
    > ..." alternating result I got previously.
    >
    > However, I was not able to reproduce this problem using
    a 5000-item toy
    > ArrayCollection (different objects). Flex made the right
    value changes
    > with
    > only one array refresh at the end.
    >
    >
    >
    quote:
    Originally posted by:
    Newsgroup User
    > Sorry.. I can't help you without see some code.
    > Rgds
    >
    > JFB
    >
    >
    > "scabbage" <[email protected]> wrote in
    message
    > news:[email protected]...
    > > JFB,
    > >
    > > I followed what you said and did a
    myArray.refresh() after I changed all
    > > my
    > > myArray.someProperty from false to true (myArray is
    the filtered array).
    > > However, in the Datagrid, the someProperty column
    didn't show "true"
    > > everywhere, but with true and false alternating
    (false, true, false,
    > > true,
    > > false...) across the datagrid. Any idea how this
    coud be solved?
    > >
    > > Thanks.
    > >
    >
    >
    >
    >
    >
    >

  • HTTPService::ArrayCollection::DataGrid

    the code:
    <mx:Script <[[CDATA[
    public var file:ArrayCollection = new ArrayCollection();
    public function resultHandler(event:ResultEvent){
    //arraycollection assignemnt
    public function faultHandler(event:FaultEvent){
    //alert
    ]]>
    <mx:HTTPService id="http" url="random.XML"
    result="resultHandler(event)"
    fault="faultHandler(event)"/>
    <mx:ArraryCollection id="ac"
    dataProvider="{http.lastResult.etc.etc.etc}" />
    <mx:DataGrid id="dg" dataProvider="{ac}" />
    For whatever reason this isn't working. the dataprovider
    specifically is causing me issues. thoughts?

    1) The default resultFormat = object. This causes Flex to
    convert your xml into a tree structure of dynamic objects. This is
    rarely desirable.
    2) set resultFormat="e4x" to preserve your xml
    3) Option A: loop over the XMLList and build an
    ArrayCollection of strongly typed value objects.
    3) Option B: The simplest way to proceed is to use
    XMLListCollection. Declare it in instance scope:
    [Bindable]private var _xlcResult:XMLListCollection;
    Bind the datagrid to that var:
    <mx:DataGrid id="dg" dataProvider="{_xlcResult}" />
    Set the dataGridColumns dataField to the xml node @attributes
    or child nodes depending on the xml
    Assign the XMLListCollection in the resultHandler:
    var xmlResult:XML = XML(event.result);
    trace(xmlResult.toXMLString()); //to be sure of your
    structure
    _xlcResult = new XMLListCollection(xmlResult.etc.etc);
    Tracy

  • ArrayCollection to populate Datagrid

    Hi,
    Im having problems getting my own array data to bind to a
    dataGrid. I've tried formating my array data several ways but none
    work. Here is an example of one of the iterations i have tried
    which i beleive should work. I build my array like this ...
    for(i) {
    arrayName.push( [{ fieldName1: value
    , fieldName2: value}] );
    which gives me a nice 2d array. this is put in an
    arrayCollection which is bindable....
    arrayCol = new ArrayCollection( arrayName);
    and it is set as the dataProvider for my grid and the
    fieldNames are set as the column dataFields ...
    <mx:DataGrid x="424" y="425" height="125" width="340"
    id="grd" editable="true" enabled="true"
    dataProvider="{arrayCol}">
    <mx:columns>
    <mx:DataGridColumn headerText="Tag"
    dataField="fieldName1" editable="false"/>
    <mx:DataGridColumn headerText="Tag Value"
    dataField="fieldName1" editable="true"/>
    </mx:columns>
    </mx:DataGrid>
    The dataGrid does populate in the sense that i am allowed to
    select the rows; the number of rows that my array consists of ...
    however the cells are empty. I've spent a fair time trying to work
    this out and search the docs / this forum. If anyone has any
    recommendations about how to bind array / arrayCollection data to a
    dataGrid it would be greatly appreciated.
    Regards

    The way you have it structured, it looks like you have a
    two-dimensional array
    where the second dimension always just contains a single
    item. Unless I'm
    misinterpreting your goal, the way to change this would be to
    remove the extra
    left/right brackets in your arrayName.push:
    change
    arrayName.push( [{ fieldName1: value<i> , fieldName2:
    value<i>}] );
    to
    arrayName.push( { fieldName1: value<i> , fieldName2:
    value<i>} );
    That way, you have a one-dimensional array, but each item in
    that array has a
    field named 'fieldName1' and another field named
    'fieldName2'.
    Here is a complete sample that works for me (with the latest
    internal build --
    I haven't tried beta 3):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="initData()">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    public var mydata:Array;
    [Bindable]
    public var arrayCol:ArrayCollection;
    private function initData():void
    mydata = [];
    mydata.push( { fieldName1: '1', fieldName2: '2' } );
    mydata.push( { fieldName1: '3', fieldName2: '4' } );
    arrayCol = new ArrayCollection(mydata);
    ]]>
    </mx:Script>
    <mx
    ataGrid x="424" y="425" height="125" width="340"
    id="grd" editable="true"
    enabled="true" dataProvider="{arrayCol}">
    <mx:columns>
    <mx
    ataGridColumn headerText="Tag" dataField="fieldName1"
    editable="false"/>
    <mx
    ataGridColumn headerText="Tag Value"
    dataField="fieldName2"
    editable="true"/>
    </mx:columns>
    </mx
    ataGrid>
    </mx:Application>
    Mike Morearty
    Developer, Flex Builder team
    http://www.morearty.com/blog
    McDusty wrote:
    > Hi,
    >
    > Im having problems getting my own array data to bind to
    a dataGrid. I've tried
    > formating my array data several ways but none work. Here
    is an example of one
    > of the iterations i have tried which i beleive should
    work. I build my array
    > like this ...
    >
    > for(i) {
    > arrayName.push( [{ fieldName1: value<i> ,
    fieldName2: value<i>}] );
    > }
    >
    > which gives me a nice 2d array. this is put in an
    arrayCollection which is
    > bindable....
    >
    > arrayCol = new ArrayCollection( arrayName);
    >
    > and it is set as the dataProvider for my grid and the
    fieldNames are set as
    > the column dataFields ...
    >
    > <mx
    ataGrid x="424" y="425" height="125" width="340"
    id="grd" editable="true"
    > enabled="true" dataProvider="{arrayCol}">
    > <mx:columns>
    > <mx
    ataGridColumn headerText="Tag" dataField="fieldName1"
    > editable="false"/>
    > <mx
    ataGridColumn headerText="Tag Value"
    dataField="fieldName1"
    > editable="true"/>
    > </mx:columns>
    > </mx
    ataGrid>
    >
    > I've spent a fair time trying to work this out and
    search the docs / this
    > forum. If anyone has any recommendations about how to
    bind array /
    > arrayCollection data to a dataGrid it would be greatly
    appreciated.
    >
    > Regards
    >

  • Update DataGrid over ArrayCollection

    Hey,
    I have got a problem with the updating capabiliy of the
    ArrayCollection.
    I fill the array like this.
    quote:
    [Bindable]
    private var content:ArrayCollection = new ArrayCollection();
    private function contentRPCResult(event:ResultEvent):void {
    content = event.result.allEntries.entry;
    The data I like to fill the ArrayCollection with, is
    information I got from a mysql database over PHP. It needs to be
    reloaded from time to time, because the content changes quiet
    frequently. So I used a "Refresh" button. While clicking on it the
    RPC "contentRPC.send();" gets sent again. The command works fine,
    because the first time the database content loads into the app.
    If I click on the refresh button, nothing happens. I thought,
    if the content of an ArrayCollection changes, the content of its
    dataprovider changes as well?! I used an XMLListCOllection in
    another app, there it works. If I send the HTTPRquest again, the
    content changes if there were any changes since the last load.
    I even tried removeAll() or refresh() to empty the Array and
    fill it again with the new data. It doesn't work. Only the first
    loaded content is displayed in the data provider. If i reload the
    whole app, the content shows the actuall content (which is the
    first loaded content, indeed!).
    So my question is: I fill an ArrayCollection with
    "contentRPC.send();" (HTTPRequest) once. The dataprovider shows the
    content. When I user "contentRPC.send()" again and the new content
    is different to the old one, how could I refill the ArrayCollection
    with the new content (it should automatically change the content of
    the dataprovider)?
    Hopefully you understand my problem. I am actually German, so
    it was hard for me to explain, what I really intend to do!
    Thanks for any help.
    greets lindner

    Hey Vygo,
    thank you for your answer. Unfurtunatly it is not a cache
    problem. I tried the unique thing, which sounds very meaningful.
    But the ArrayCollection still gets not refreshed, or reloaded. When
    I use the PHP Script on its own, it always shows the current
    content, using no cache at all. So I know the right content gets
    passed to the flex app, but the app does not use it!
    Any other suggestions, maybe there is a cache problem in
    flex?
    I just took a look in the older app where I used an
    XMLListCollection to fill the dataprovider.
    There the command to gill the XMLListCollection was
    "HTTPRequest_ID.
    lastResult.XML_node". Now I fill the ArrayCollection only
    with "content = event.
    result.allEntries.entry;". I can not use lastResult at this
    point. Might this be a problem? I an't believe there is no way to
    fill an ArrayCollection at runtime more than one time?!
    greetings lindner

  • Datagrid Image Renderer Broken in CS SDK but not Flex project

    Within a Photoshop Extension, I have a DataGrid which has an inline custom image renderer whose dataprovider is an ArrayCollection called "photos"  representing a list of photos and some metadata properties.  One of the properties "fileName" is concatenated with a path to a thumbnail image such as source="{'LR_AUTO/imported/thumbs/' + data.fileName}".
    The dataprovider is bound to a LCDS DataService. When the extension is first launched, the dataservice initializes the dataprovider with the existing values for the "photos" arraycollection.  The thumbnail images are correctly shown.
    However, when the DataService receives a new row and updates the photos dataprovider, the datagrid's new row shows a broken image for the thumbnail even though the path is correct.  I have dumped the photos dataprovider and verified that all information is correct.  When I close Photoshop and relaunch it from Flash Builder, once again LCDS initializes the photos ArrayCollection and THEN the thumbnail that previously showed as broken show up correctly.
    I have a ColdFusion Directory Watcher Gateway that watches a directory where Lightroom auto-imports images from a tethered capture session.  When the camera sends Lightroom a new image, the new image is processed by Lightroom and moved to a target directory, and since ColdFusion's Directory Watcher is watching that targeted directory, ColdFusion will create a thumbnail image in a subfolder and notifiy LCDS that of the new image and related metadata.
    *** This is the interesting part *** When Lightroom places new images in the target directory, this is propogated to the Photoshop Extension's datagrid, and the new row shows up as described earlier, showing a broken image for the thumbnail.  BUT, instead of Lightroom, if I manually copy images to the folder where ColdFusion is watching, then exact same code path is exectuted and in the Photoshop Datagrid the new row appears and THE THUMBNAIL IMAGE shows up correctly.
    The difference seems to be only in how the images are put in the original target location.  The problem is when Lightroom puts them there, but it works when I put them there as a user.
    *** More Interesting Info *** I have the Flex code for the Photoshop Extension duplicated in a standalone, non-CSSDK project using Flex 3.4 which I launch in a browser.  I have mirrored the code in the Photoshop extension, but in this manner, the problem does not exist.  With plain Flex 3.4 in a browser, whenever LCDS notifies the datagrid of a new photo record, the datagrid's new row ALWAYS shows the thumbnail correctly.
    A primary difference in how the thumbnail image is rendered is that in a browser, the Flex 3.4 project accesses the image assets over the network, however, in the Photoshop Extension, the image asset WITH THE SAME RELATIVE PATH is accessed over the local file system.
    source="{'LR_AUTO/imported/thumbs/' + data.fileName}"
    So in the case of the browser, this path is a relative URL and the image is retrieved over HTTP, however, in the PS Extension, the same path represents a file system path relative to the project folder.
    Unfortunately, because the Flash Player (including APE) cannot access BOTH the network and the local filesystem, so I cannot change the Extension to use network access.
    ** The important part to remember is that when I stop the Flash Builder debug session and close Photoshop, then relaunch the debug with Photoshop, then all the images show up correctly in the Extension.
    Your advice is appreciated.
    Thank you!
    Steve
    ====================================================
    Environment
    ====================================================
    Photoshop CS5 Extended 12.01 x32
    Flash Builder 4
    CS SDK 1.02
    Extension Builder SDK 3.4
    MacBook Pro / OS X 10.5 / Intel Core 2 Duo 2.66 GHz / Procs: 1 / Cores: 2 / Memory: 8 GB
    App configured for Photoshop CS5 and Photoshop CS5 Extended
    ====================================================
    NewsAgencyPhotoshop.mxml
    ====================================================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="com.stevenerat.news.*"
                    horizontalScrollPolicy="off" verticalScrollPolicy="off" verticalGap="0"
                    layout="vertical" horizontalAlign="left"  backgroundColor="#353535"
                    historyManagementEnabled="false"
                    creationComplete="init();">
        <mx:Script>
                public function handlePhotoClick(data:Object):void {
                    this.PreviewImageWindow = PreviewImage(PopUpManager.createPopUp(this,PreviewImage,true));
                    var filePath:String = data.dirPath + data.fileName;
                    PreviewImageWindow.addEventListener("imageOpenEvent",imageOpenListener);
                    PreviewImageWindow.addEventListener("imageCloseEvent",imageCloseListener);
                    PreviewImageWindow.addEventListener("imageSavedEvent",imageSaveListener);
                    PreviewImageWindow.setFileName(data.fileName);
                    PreviewImageWindow.setFilePath(filePath);
                    PreviewImageWindow.y = 0;
                    PreviewImageWindow.x = 0;
            ]]>
        </mx:Script>
        <mx:ArrayCollection id="photos"/>
        <NewsPhoto/>
        <mx:DataService id="ds" destination="NewsAgencyPhotos" autoSyncEnabled="true" autoCommit="true" conflict="conflictHandler(event)"/>
        <mx:Label text="News Agency Photos" fontSize="20" paddingBottom="30"/>
        <mx:Label text="Available Images" fontSize="15"/>
        <mx:DataGrid id="photoIPTC" dataProvider="{photos}" editable="true" width="220" rowCount="5" rowHeight="75" wordWrap="true">
            <mx:columns>
                <mx:DataGridColumn headerText="id" dataField="fileName" width="40" editable="false" sortDescending="true"/>
                <mx:DataGridColumn dataField="psLock" width="65" headerText="Status" editable="false" editorDataField="value">
                    <mx:itemEditor>
                        <mx:Component>
                            <mx:ComboBox editable="false">
                                <mx:dataProvider>
                                    <mx:String>New</mx:String>
                                    <mx:String>Open</mx:String>
                                    <mx:String>Edited</mx:String>
                                </mx:dataProvider>
                            </mx:ComboBox>
                        </mx:Component>
                    </mx:itemEditor>
                </mx:DataGridColumn>
                <mx:DataGridColumn headerText="Photo" dataField="fileName" width="80" editable="false">
                    <mx:itemRenderer>
                        <mx:Component>
                            <mx:HBox horizontalAlign="center" horizontalScrollPolicy="off" verticalScrollPolicy="off">
                                <mx:Image click="outerDocument.handlePhotoClick(data);" source="{'LR_AUTO/imported/thumbs/' + data.fileName}" width="75" height="75"/>
                            </mx:HBox>
                        </mx:Component>
                    </mx:itemRenderer>
                </mx:DataGridColumn>
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>
    ====================================================
    A DUMP OF THE DATAPROVIDER
    in this case, one array item existed when launched, then a second was added
    while running.  The first has its thumbnail show, the second item has broken image
    ====================================================
    ------------------DUMP----------------------------
    (mx.collections::ArrayCollection)#0
      filterFunction = (null)
      length = 2
      list = (mx.data::DataList)#1
        fillParameters = (Array)#2
        length = 2
        localItems = (Array)#3
          [0] (com.stevenerat.news::NewsPhoto)#4
            aperture = "F10"
            cameraLens = "EF24-70mm f/2.8L USM"
            cameraModel = "Canon EOS 7D"
            city = ""
            copyrightNotice = "¬© Steven Erat 2011"
            country = ""
            creator = "Steven Erat"
            description = ""
            dirPath = "/Users/stevenerat/LR_AUTO/imported/"
            fileName = "ERAT_STEVEN_20110122_162.jpg"
            focalLen = "42.0 mm"
            headline = ""
            id = 1
            iso = "100"
            keywords = "Alt, Dramatic, Fashion, Girl, Glamorous, Glamour, Inked, Model, Portrait, SOPHA"
            psLock = "New"
            shutterSpeed = "1/128 sec"
            state = ""
          [1] (com.stevenerat.news::NewsPhoto)#5
            aperture = "F10"
            cameraLens = "EF24-70mm f/2.8L USM"
            cameraModel = "Canon EOS 7D"
            city = ""
            copyrightNotice = "¬© Steven Erat 2011"
            country = ""
            creator = "Steven Erat"
            description = ""
            dirPath = "/Users/stevenerat/LR_AUTO/imported/"
            fileName = "ERAT_STEVEN_20110122_163.jpg"
            focalLen = "42.0 mm"
            headline = ""
            id = 2
            iso = "100"
            keywords = "Alt, Dramatic, Fashion, Girl, Glamorous, Glamour, Inked, Model, Portrait, SOPHA"
            psLock = "New"
            shutterSpeed = "1/128 sec"
            state = ""
        uid = "8BAC025E-60D1-11F1-3654-44BDB0D218CE"
        view = (mx.collections::ArrayCollection)#6
          filterFunction = (null)
          length = 2
          list = (mx.data::DataList)#1
          sort = (null)
          source = (null)
      sort = (null)
      source = (null)
    ------------------END_DUMP------------------------

    I expected that if my extension uses the local filesystem AND the network that I would get a Security Sandbox Exception as I recently described in this thread:
    http://forums.adobe.com/thread/791918?tstart=0
    However, I just tried changing my datagrid image renderer to access the thumbnail via HTTP and the thumbnail issue after Lightroom export does not happen.
                <mx:DataGridColumn headerText="Photo" dataField="fileName" width="80" editable="false">
                    <mx:itemRenderer>
                        <mx:Component>
                            <mx:HBox horizontalAlign="center" horizontalScrollPolicy="off" verticalScrollPolicy="off">
                                <mx:Image click="outerDocument.handlePhotoClick(data);" source="{'http://localhost:8500/LR_AUTO/imported/thumbs/' + data.fileName}" width="75" height="75"/>
                            </mx:HBox>
                        </mx:Component>
                    </mx:itemRenderer>
                </mx:DataGridColumn>
    Furthermore, I can also open the image via the Photoshop DOM, and it does open correctly.  It seems that I do have a solution now, although I'm not certain as to why I'm not getting a Security Sandbox Exception as I described in the other post.
    Thanks for reading.

  • DataGrid does not display XML data

    Hello, and thanks for reading this...
    I am having a problem displaying XMLList data in a DataGrid.
    The data is coming from a Tree control, which is receiving it
    from a database using HTTPService.
    The data is a list of "Job Orders" from a MySQL database,
    being formatted as XML by a PHP page.
    If it would be helpful to see the actual XML, a sample is
    here:
    http://www.anaheimwib.com/_login/get_all_orders_test2.php
    All is going well until I get to the DataGrid, which doesn't
    display the data, although I know it is there as I can see it in
    debug mode. I've checked the dataField property of the appropriate
    DataGrid column, and it appears correct.
    Following is a summary of the relevant code.
    ...An HTTPService named "get_all_job_orders" retrieves
    records from a MySQL database via PHP...
    ...Results are formatted as E4X:
    HTTPService resultFormat="e4x"
    ...An XMLListCollection's source property is set to the
    returned E4X XML results:
    ...The "order" node is what is being used as the top-level of
    the XML data.
    <mx:XMLListCollection id="jobOrdersReviewXMLList"
    source="{get_all_job_orders.lastResult.order}"/>
    ...The "jobOrdersReviewXMLList" collection is assigned to be
    the dataProvider property of a Tree list, using the @name syntax to
    display the nodes correctly, and a change event function is defined
    to add the records to a DataGrid on a separate Component for
    viewing the XML records:
    <mx:Tree dataProvider="{jobOrdersReviewXMLList}"
    labelField="@name"
    change="jobPosForm.addTreePositionsToDG(event)"/>
    ...Here is the relevant "jobPosForm" code (the Job Positions
    Form, a separate Component based on a Form) :
    ...A variable is declared:
    [Bindable]
    public var positionsArray:XMLList;
    ...The variable is initialized on CreationComplete event of
    the Form:
    positionsArray = new XMLList;
    ...The Tree's change event function is defined within the
    "jobPosForm" Component.
    ...Clicking on a Tree node fires the Change event.
    ...This passes an event object to the function.
    ...This event object contains the XML from the selected Tree
    node.
    ...The Tree node's XML data is passed into the positionsArray
    XMLList.
    ...This array is the dataProvider for the DataGrid, as you
    will see in the following block.
    public function addTreePositionsToDG(event:Event):void{
    this.positionsArray = selectedNode.positions.position;
    ...A datagrid has its dataProvider is bound to
    positionsArray.
    ...(I will only show one column defined here for brevity.)
    ...This column has its dataField property set to "POS_TITLE",
    a field in the returned XML record:
    <mx:DataGrid width="100%" variableRowHeight="true"
    height="75%" id="dgPositions"
    dataProvider="{positionsArray}" editable="false">
    <mx:columns>
    <mx:DataGridColumn width="25" headerText="Position Title"
    dataField="POS_TITLE"/>
    </mx:columns>
    </mx:DataGrid>
    In debug mode, I can examine the datagrid's dataProvider
    property, and see that the correct XML data from the Tree control
    is present. However, The datagrid does not display the data in any
    of its 6 columns.
    Does anyone have any advice?
    Thanks for your time.

    Hello again,
    I came up with a method of populating the DataGrid from the
    selected Item of a Tree Control which displays complex XML data and
    XML attributes. After the user clicks on a Tree branch, I call this
    function:
    public function addTreePositionsToDG(event:Event):void{
    //Retrieve all "position" nodes from tree.
    //Loop thru each Position.
    //Add Position data to the positionsArray Array Collection.
    //The DataGrid dataprovider is bound to this array, and will
    be updated.
    positionsArray = new ArrayCollection();
    var selectedNode:Object=event.target.selectedItem;//Contains
    entire branch.
    for each (var position:XML in
    selectedNode.positions.position){
    var posArray:Array = new Array();
    posArray.PK_POSITIONID = position.@PK_POSITIONID;
    posArray.FK_ORDERID = position.@FK_ORDERID;
    posArray.POS_TITLE = position.@POS_TITLE;
    posArray.NUM_YOUTH = position.@NUM_YOUTH;
    posArray.AGE_1617 = position.@AGE_1617;
    posArray.AGE_1821 = position.@AGE_1821;
    posArray.HOURS_WK = position.@HOURS_WK;
    posArray.WAGE_RANGE_FROM = position.@WAGE_RANGE_FROM;
    posArray.WAGE_RANGE_TO = position.@WAGE_RANGE_TO;
    posArray.JOB_DESCR = position.@JOB_DESCR;
    posArray.DES_SKILLS = position.@DES_SKILLS;
    positionsArray.addItem(posArray);
    So, I just had to manually go through the selected Tree node,
    copy each XML attribute into a simple Array, then ADD this Array to
    an ArrayCollection being used as the DataProvider for the DataGrid.
    It's not elegant, but it works and I don't have to use a Label
    Function, which was getting way too complicated. I still think that
    Flex should have an easier way of doing this. There probably is an
    easier way, but the Flex documentation doesn't provide an easy path
    to it.
    I want to thank you, Tracy, for the all the help. I checked
    out the examples you have at www.cflex.net and they are very
    helpful. I bookmarked the site and will be using it as a resource
    from now on.

  • How can i access a mysql table without putting the data in a datagrid

    I developed my air app with a datagrid which uses a php service to display all data from a table of strings in MySql.
    I now do not need the datagrid, how can i get the data from my database without putting it into a dataGrid? Do i need an array? how do i do this? anyone got any example code?

    Balakrishnan V wrote:
    var resultArrayCollection:ArrayCollection=new ArrayCollection()
    protected function resultHandler(event:ResultEvent)
         result=event.result as ArrayCollection
    You can use the result array collection now inside your program for any further changes / manipulations.
    Hope this helps; If you have further doubts, do ask...
    Balakrishnan V
    Hi, yeah this helps,
    however, how would i generate a result handler for a service that has not been called yet? Sorry my knowledge of services is very limited.
    This is a php service, get_all service that returns all the rows from a mysql table.
    I can see the service box with the service i want to use:
    but how do i pass that to a result handler?

Maybe you are looking for

  • MII 14.0 SP4 :Migration error while importing SAP BM Templates

    Hi Experts, I am facing some migration errors while importing SAP Batch Manufacturing Templates into MII 14.0 SP4. There are almost 23 transactions which are not getting imported and the error message for all of them is- "Unable to migrate transactio

  • Sap query not working after Upgradtion

    Hi Experts, We have recently done up gradation from 4.6 to Ecc 6.0. Since then my Sap query are not working. Please help how to fix the issue. Thanks in Advance for your support and time.

  • Function EXCEL_OLE_STANDARD_DAT Dump CX_SY_CONVERSION_NO_NUMBER

    Hi everybody, We are migrating R/3 from 4.6 to 5.0, when executing Z's programs using function 'EXCEL_OLE_STANDARD_DAT' in the new version it ends in a short dump CX_SY_CONVERSION_NO_NUMBER, that's because de field of the data table for the column in

  • A sql problem

    Let me explain my question. I have a table ITEM(item_number varchar2(20), amount number) Item_number  amount A000001  15000 A0002  2000 A00003  -800 A00004  100 A00005  2500 A000006  -1000 A00007  60 I show a report like following: Total:18800 Detail

  • Converting avi files so I can view on apple tv

    I am very very new to the mac world so please don't laugh!  How do I convert avi files to a format I can view on my apple tv.  I have recently purchase a macbook pro.  Do I simply download software??  thanks so much, Karen