Datagrid woes

I'm trying to get info from every field in a data grid. eg.
looping through by column and row to get all the info out and put
it into another form.
I mainly don't know how to specify what row to pull data
from. and using "selectedItem" only works for the row selected.
Even if there is a better way to do this, if you know how to
do it this way please let me know (for knowledge sake)
-thanks.
ps- I just read the about updating the dataProvider... any
examples on how to do that?

var index:IListItemRenderer = mydg.indexToItemRenderer(i);
for(var j in index.data){
trace(j+"; "+index.data[j]);
mydg is the name of my datagrid. the i being passed is a row
number (starts at 1, not 0).
It appears you need to pass your row into an
IlistItemRenderer before you can view the data.
Definately not impressed on the programming theories behind
the datagrid. I don't see what was wrong with having something like
DataGrid.row[x] or something of that simplicity.

Similar Messages

  • Getting the ExplicitWidth of a DataGridColumn

    Please see the code provided. It is a simplified version of
    what I am trying to do. I need to be able to programmatically
    determine if a DataGridColumn's width attribute has been explicitly
    set; for example, columns A and C.
    In the debug panel in Flex Builder I can see that each
    DataGridColumn has a explicitWidth property but it is a Protected
    property so I cannot access it. Is there a way to get() this
    property or is there another way to determine if a DataGridColumn's
    width has been explicit set?
    Thanks.

    Adobe Newsbot hopes that the following resources helps you.
    NewsBot is experimental and any feedback (reply to this post) on
    its utility will be appreciated:
    Flex 3 - Automatically generating database applications:
    The Flex Builder project's WebContent directory contains
    directories to be ... listed table fields to exclude them from the
    generated Flex DataGrid control.
    Link:
    http://livedocs.adobe.com/flex/3/html/data_3.html
    Flex Builder 2.0.1 DataGrid Woes...:
    The following example was compiled on my machine in Flex
    Builder 2.0. Youll notice that you can close the DataGrid to any
    width including zero.
    Link:
    http://asserttrue.com/articles/2007/01/12/flex-builder-2-0-1-datagrid-woes
    Flex 3 - Application coding:
    However, there are some techniques that a Flex developer can
    use to ..... For example, a DataGrid control that contains both
    text and graphics inside a cell
    Link:
    http://livedocs.adobe.com/flex/3/html/performance_08.html
    2007 August archive at Flex Examples:
    The following example demonstrates how you can create a Flex
    DataGrid .... Well, the answer is you have to download the public
    Flex Builder beta from
    Link:
    http://blog.flexexamples.com/2007/08/
    FLEX{er} datagrid:
    To make it crystal clear follow the example bellow Having the
    [] Popularity: 55% ... Touka: They are using AJAX for the builder
    interface.
    Link:
    http://www.flexer.info/tag/datagrid/
    Using a custom context menu with the Flex DataGrid control at
    Flex:
    This page works fine in FireFox, but when I just run the
    example code in FireFox from Flex Builder I get the strange
    behavior. Im using FireFox 2.
    Link:
    http://blog.flexexamples.com/2007/08/20/using-a-custom-context-menu-with-the-flex-datagrid -control/
    Disclaimer: This response is generated automatically by the
    Adobe NewsBot based on Adobe
    Community
    Engine.

  • DataGrid n000bie - headerText and data woes...

    Hi,
    So, I haven't worked with the DataGrid before until now; what I'm trying to do is grab the data from the first line of xmlDP, '<team>', and utilize those attributes as the column headerText(i.e.: 1. Chk, 2. Nam0rz, 3. Average, etc...). I can get that going, but I can't insert my data after I alter the col.headerText. via addColumn. See the comments in the code below for more of a description, but seeing how the DataGrid is a new paradigm for me, I know I'm doing this all wrong.
    If anyone can help me wrangle this code together in order to get the desired outcome, or explain how to better construct the below code in order to achieve the desired outcome, I would greatly appreciate it.
    import fl.data.DataProvider;
    import fl.controls.dataGridClasses.DataGridColumn;
    import fl.data.DataProvider;
    import fl.controls.DataGrid;
    import fl.data.DataProvider;
    var loader:URLLoader = new URLLoader;
    var aDg:DataGrid = new DataGrid();
    var xmlDP:XML = <team col0="1. Chk" col1="2. Nam0rz" col2="3. Average" col3="4. DATA" col4="5. DATA2">
                    <player checkBox="" name="Player G" avg="0.493" data="BLAH 7" data2="BLAH 17"/>
                    <player checkBox="" name="Player H" avg="0.414" data="BLAH 8" data2="BLAH 88"/>
                    <player checkBox="" name="Player I" avg="0.517" data="BLAH 9" data2="BLAH 19"/>    
                    <player checkBox="" name="Player J" avg="0.693" data="BLAH 10" data2="BLAH 20"/>
                    <player checkBox="" name="Player K" avg="0.714" data="BLAH 11" data2="BLAH 21"/>
                    <player checkBox="" name="Player L" avg="0.817" data="BLAH 12" data2="BLAH 22"/>
    </team>;
    createDataGrid();
    function createDataGrid():void
        aDg.move(400, 40);
        aDg.width = 500;   
        aDg.rowCount = aDg.length;    
        var i:int;
        var attrArray:Array = [];   
        var nodeArray:Array = [];   
        for each (var att:XML in xmlDP.@*)
            aDg.rowCount = i;
            attrArray.push(xmlDP.@*[i]);
            trace("attrArray = "+ attrArray[i]);
            var col:DataGridColumn = new DataGridColumn(attrArray[i]);
            //if I comment out the next line, I get all the data I want, but lose the headerText I want.
            //If I don't comment it out, I get the headerText I want, but lose the data I want.
            //aDg.addColumn(col);
            col.headerText = String(attrArray[i]);               
            i++;       
            var myString:String;                   
        var myDP:DataProvider = new DataProvider(xmlDP);        
        aDg.dataProvider = myDP;  
        addChild(aDg);
    Thanks muchleh,
    Chipleh

    Hi again kglad,
    Thanks for the response. I was trying specifically not to use ["checkBox", "name", "avg", "data", "data2"] and instead use the values of the attributes of <team>. Regardless, I've scrapped that idea for now, as that seems to go against the paradigm of the dataGrid(like I mentioned, I'm n00b to this component).
    The thing that's really got me stumped right now is this: When using the code below, the columns are constantly shifting when I compile(i.e.: the "name" column(or any other column for that matter) is never in the same place, they shift all over. Is there something you need to enable in the DataGrid to get consistent column placement results? What I'm expecting to see per my xml is:
    checkBox | name | avg | data | data2
    but instead I'll see:
    data2 | name | avg | data | checkBox
    or:
    data | name | checkBox | data2 | avg
    etc. The columns are never consistent.
    import fl.data.DataProvider;
    import fl.controls.dataGridClasses.DataGridColumn;
    import fl.data.DataProvider;
    import fl.controls.DataGrid;
    import fl.data.DataProvider;
    var loader:URLLoader = new URLLoader;
    var aDg:DataGrid = new DataGrid();
    var xmlDP:XML = <team>
                    <player checkBox="" name="Player G" avg="0.493" data="BLAH 7" data2="BLAH 17"/>
                    <player checkBox="" name="Player H" avg="0.414" data="BLAH 8" data2="BLAH 88"/>
                    <player checkBox="" name="Player I" avg="0.517" data="BLAH 9" data2="BLAH 19"/>    
                    <player checkBox="" name="Player J" avg="0.693" data="BLAH 10" data2="BLAH 20"/>
                    <player checkBox="" name="Player K" avg="0.714" data="BLAH 11" data2="BLAH 21"/>
                    <player checkBox="" name="Player L" avg="0.817" data="BLAH 12" data2="BLAH 22"/>
    </team>;
    addDataGrid();
    function addDataGrid():void
        var teamXML:XML = new XML(loader.data);        
        aDg.setSize(500, 100);
        aDg.move(400, 40);     
        aDg.rowCount = aDg.length;
        var myDP:DataProvider = new DataProvider(xmlDP);    
        aDg.dataProvider = myDP;
           aDg.rowCount = aDg.length;
        addChild(aDg);
        aDg.name = "aDg";

  • Continual Mac woes (no question, just a rant)

    It's Tuesday, and I am having terrible problems with my Mac. But then, why should Tuesday be different from any other day of the week.
    Here is a typical day for me. The computer appears to be working OK. I need to watch a DVD for my work. I turn on DVD player, and put one in. The machine can't read the disc. It clicks and whirls, but the icon does not show up on the desktop. Meanwhile, so distressed is the machine that it freaks out. What was up until now was a fluidly operating machine suddenly reverts back to its old ways (i.e., its ways of two days ago). The hold ups and spinning pinwheels begin to eat of hours of my work day. (Remember the old days when computers made life easier?) The machine becomes sticky, gummy. Oh, I can move the curser and it seems to work for a second but then gets stuck in the dock, which explodes in icons and then freezes for five minutes. Yes. Five minutes.
    Would love to use Force Quit, but the cursor is spinning, and nothing is responding. Funny about that old Mac. You can't force quit Force Quit. I guess I need to leave it open all the time.
    Of course, FQ usually works on Safari. I have never just "quit" Safari. It always requires Force Quit, otherwise I can't turn off my computer. It stalls shut down.
    Now I have a DVD trapped in there and can't get it out. [But I just got an answer from another posting.]
    In the old macs, there used to be a pin hole you could stick a needle into ... can't find one on my flatpanel iMac.
    I bought my Apple flat panel iMac in August of 2002. Yes, I know that that is a long time to have a computer, but I am not rich nor attached to a corporation that can splurge on computers. The first weekend I had the machine, I had three kernal panics.
    Among the other problems I have documented are the following: the dock hiding itself unbidden and other features checking and unchecking themselves (Aug 2002); bus errors connected with OS 9 (Sept); some problems that inspired the tech person (Eric)) to talk me through deleting my user i.d., resulting in the loss of two months worth of e-mail (Thursday, 12 September); Preview problems (September); a bizarre box with an unmovable and undeletable red stop sign in it that no tech person or other Mac user I know had ever hear of (Monday 30 September); printing problems; computer won't shut down, numerous disconnection errors, which turned out to be caused by an OS X update (beginning December, 2002, or later); Kernel panics (Feb); computer won't shut down (March); Faxstexx problems, program won't allow me to set it up, finally just deleted the software (April); keys like "V" freeze and repeat endlessly (May 21); DVD Player freezes (May); Safari and Mail begin quitting unexpectedly (May); cursor begins to blink and fade out, plus odd sounds come out of the speakers, a constant error beeping (Sept 9); DVD Player problems (Oct 4).
    I called AppleCare while I had it about once a week (the total between August 2002 and the time it ran out was about 155 calls). Naturally, some of these calls are motivated by user error. On the other hand, many of the issues I have called about were unprecedented as far as the Tech person was concerned, such as the blinking mouse, the red stop sign, and the DVD Player woes.
    Things improved with Panther, but in Tiger many of the same old issues have returned.
    I have been having so many problems with my Mac that I once wrote a letter to the company asking when do I qualify for a new replacement machine. I never received an answer, but I felt better for about a day. Then I turned on my Mac again.

    The spinning ball of death as we used to call it is often caused by a lack of RAM, it is hard to be sure as I am not working on your machine, but sometimes things can be improved with additional RAM, it makes it seem like a whole new computer.
    A lot of your problems sound like stuff that can be fixed easily enough, and although frustrating things happen here and there with updates. It sounds like you are in fairly good spirits with it all, I would suggest just researching a bit more into maintenance you can do to help maintain the computer and educate yourself a bit more (sounds like you already have learned quite a bit along the way) and you will find a lot of these issues take you a few seconds to rid yourself of. I would start by making sure you are repairing permissions regularly and running the most up to date software. If a lot of problems persist, try creating a second user that is a "test" user to see if the problem is replicated on that user (don't delete your other one, but if you do find the problem not on the other user, you might have a corrupt user, however you don't have to lose all your emails there are plenty of ways to back it up and import it in, or even just bring the entire Mail folder from your library over to the new user). Another thing you can do if you find a lot of system problems is archive and install the OS, it takes a bit of time, but doing it overnight shouldn't be an issue, and you won't lose any of your stuff.

  • 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?

  • DataGrid not reflecting changes after INSERT into Table. Delete from Table does.

    Wow, it's been a while.
    Hope you guys can help.
    This is my DataGrid:
    <DataGrid DataContext="{StaticResource TableAssetsViewSource}" ItemsSource="{Binding}" x:Name="TableAssetsDataGrid" AutoGenerateColumns="False" EnableRowVirtualization="True" Margin="15,10,10,10" RowDetailsVisibilityMode="VisibleWhenSelected" Grid.Column="1" HeadersVisibility="Column" CanUserResizeRows="False" IsReadOnly="True">
    <DataGrid.CellStyle>
    <Style TargetType="DataGridCell">
    <Setter Property="BorderThickness" Value="0"/>
    </Style>
    </DataGrid.CellStyle>
    <DataGrid.Columns>
    <DataGridTextColumn x:Name="NodeColumn" Binding="{Binding node}" Header="VS Number" Width="*"/>
    <DataGridTextColumn x:Name="SerialColumn" Binding="{Binding serial}" Header="Serial Number" Width="*"/>
    <DataGridTextColumn x:Name="NameColumn" Binding="{Binding name}" Header="Asset Name" Width="*"/>
    <DataGridTextColumn x:Name="TypeColumn" Binding="{Binding type}" Header="Asset Type" Width="*"/>
    <DataGridTextColumn x:Name="_dateColumn" Binding="{Binding date}" Header="Date Allocated" Width="*"/>
    <DataGridTextColumn x:Name="PoColumn" Binding="{Binding po}" Header="Purchase Order" Width="*"/>
    </DataGrid.Columns>
    </DataGrid>
    This is where I add a new Row to the Table:
    Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
    Dim cbblocation As ComboBox = Me.FindName("LocationComboBox")
    Dim row As DataRowView = DirectCast(cbblocation.SelectedItem, DataRowView)
    Dim cbbtext As String = row.Item("node")
    Dim cbbtype As ComboBox = Me.FindName("comboBoxType")
    Dim cbbtext2 As String = cbbtype.Text
    Dim RETAILISOAMDDataSet As Retail_ISO_AMD.RETAILISOAMDDataSet = CType(Me.FindResource("RETAILISOAMDDataSet"), Retail_ISO_AMD.RETAILISOAMDDataSet)
    Dim RETAILISOAMDDataSetTableAssetsTableAdapter As Retail_ISO_AMD.RETAILISOAMDDataSetTableAdapters.tableAssetsTableAdapter = New Retail_ISO_AMD.RETAILISOAMDDataSetTableAdapters.tableAssetsTableAdapter()
    RETAILISOAMDDataSetTableAssetsTableAdapter.AddNewAsset(cbbtext, txbSerial.Text, txbName.Text, cbbtext2, Date.Today, txbPO.Text)
    node = cbbtext
    Dim mp As New MainPage
    mp.RefreshGrid(node)
    Me.Close()
    End Sub
    The RefreshGrid method:
    Public Sub RefreshGrid(node As String)
    Dim RETAILISOAMDDataSet As Retail_ISO_AMD.RETAILISOAMDDataSet = CType(Me.FindResource("RETAILISOAMDDataSet"), Retail_ISO_AMD.RETAILISOAMDDataSet)
    Dim RETAILISOAMDDataSetTableAssetsTableAdapter As Retail_ISO_AMD.RETAILISOAMDDataSetTableAdapters.tableAssetsTableAdapter = New Retail_ISO_AMD.RETAILISOAMDDataSetTableAdapters.tableAssetsTableAdapter()
    RETAILISOAMDDataSetTableAssetsTableAdapter.FillByNode(RETAILISOAMDDataSet.tableAssets, node)
    Dim TableAssetsViewSource As System.Windows.Data.CollectionViewSource = CType(Me.FindResource("TableAssetsViewSource"), System.Windows.Data.CollectionViewSource)
    Dim be As BindingExpression = BindingOperations.GetBindingExpression(TableAssetsViewSource, CollectionViewSource.SourceProperty)
    be.UpdateTarget()
    End Sub
    And this is what I use to delete a row from the table (and without doing anything special, the DataGrid auto-updates with the changes):
    Private Sub Button_Click_4(sender As Object, e As RoutedEventArgs)
    If TableAssetsDataGrid.SelectedIndex = -1 Then
    MsgBox("You have selected nothing to Delete!", MsgBoxStyle.OkOnly, "Nothing Selected")
    Else
    Dim dgv As DataGridTextColumn = Me.FindName("NodeColumn")
    Dim row As DataRowView = DirectCast(Me.TableAssetsDataGrid.SelectedItem, DataRowView)
    Dim dgvText As String = row.Item("node")
    Dim dgv2 As DataGridTextColumn = Me.FindName("SerialColumn")
    Dim row2 As DataRowView = DirectCast(Me.TableAssetsDataGrid.SelectedItem, DataRowView)
    Dim dgvText2 As String = row.Item("serial")
    Dim dgv3 As DataGridTextColumn = Me.FindName("NameColumn")
    Dim row3 As DataRowView = DirectCast(Me.TableAssetsDataGrid.SelectedItem, DataRowView)
    Dim dgvText3 As String = row.Item("name")
    Dim dgv4 As DataGridTextColumn = Me.FindName("TypeColumn")
    Dim row4 As DataRowView = DirectCast(Me.TableAssetsDataGrid.SelectedItem, DataRowView)
    Dim dgvText4 As String = row.Item("type")
    Dim dgv5 As DataGridTextColumn = Me.FindName("_dateColumn")
    Dim row5 As DataRowView = DirectCast(Me.TableAssetsDataGrid.SelectedItem, DataRowView)
    Dim dgvText5 As String = row.Item("date")
    Dim dgv6 As DataGridTextColumn = Me.FindName("POColumn")
    Dim row6 As DataRowView = DirectCast(Me.TableAssetsDataGrid.SelectedItem, DataRowView)
    Dim dgvText6 As String = row.Item("po")
    Dim RETAILISOAMDDataSet As Retail_ISO_AMD.RETAILISOAMDDataSet = CType(Me.FindResource("RETAILISOAMDDataSet"), Retail_ISO_AMD.RETAILISOAMDDataSet)
    Dim RETAILISOAMDDataSetTableAssetsTableAdapter As Retail_ISO_AMD.RETAILISOAMDDataSetTableAdapters.tableAssetsTableAdapter = New Retail_ISO_AMD.RETAILISOAMDDataSetTableAdapters.tableAssetsTableAdapter()
    RETAILISOAMDDataSetTableAssetsTableAdapter.RemoveAsset(dgvText, dgvText2, dgvText3, dgvText4, dgvText5, dgvText6)
    Dim cbb As ComboBox = Me.FindName("cbbLocation")
    Dim row7 As DataRowView = DirectCast(cbb.SelectedItem, DataRowView)
    Dim cbbtext As String = row.Item("node")
    RefreshGrid(cbbtext)
    End If
    End Sub
    --------- End of Edit
    It is bound to a Dataset which gets it's data from a SQL Database.
    Loading the Data and Filtering the data based on certain conditions work 100%. The problem I am having is as follows:
    I have a form on the Page that takes input and inserts a row into the Database. When this happens, the DataGrid won't automatically reflect the changes (even if I recall the Fill Method of the Dataset). No matter what I do, I have to refresh the entire page
    and THEN Fill the Dataset to see any changes.
    This is what strikes me as odd...
    When I do a delete row operation on the Database (Custom Method on the Dataset with conditions), and just Fill the Dataset again (without doing anything special), the row deletes and the changes is reflected IMMEDIATELY.
    What am I doing wrong here? Why would Delete Row reflect the changes on the DataGrid but no Insert Row?
    Thanks in Advance.
    (P.S. I am very rusty with my developing skills, I haven't done this in YEARS)

    >>And what about the the most important question, how exactly is TableAssetsViewSource defined in the XAML markup and what is
    its Source property set or bound to? And what about the reproducable sample...?
    Here is the Markup of the TableAssetsViewSource:
    <Page.Resources>
    <local:RETAILISOAMDDataSet x:Key="RETAILISOAMDDataSet"/>
    <CollectionViewSource x:Key="TableRegionsViewSource" Source="{Binding tableRegions, Source={StaticResource RETAILISOAMDDataSet}}"/>
    <CollectionViewSource x:Key="TableLocationsViewSource" Source="{Binding tableLocations, Source={StaticResource RETAILISOAMDDataSet}}"/>
    <CollectionViewSource x:Key="TableAssetsViewSource" Source="{Binding tableAssets, Source={StaticResource RETAILISOAMDDataSet}}"/>
    </Page.Resources>
    The ItemsSource of the DataGrid is bound to the TableAssetsViewSource:
    <DataGrid DataContext="{StaticResource TableAssetsViewSource}" ItemsSource="{Binding}" x:Name="TableAssetsDataGrid" AutoGenerateColumns="False" EnableRowVirtualization="True" Margin="15,10,10,10" RowDetailsVisibilityMode="VisibleWhenSelected" Grid.Column="1" HeadersVisibility="Column" CanUserResizeRows="False" IsReadOnly="True">
    Just remember, this code was auto-generated with the drag & drop onto the Page, so I did little in terms of setting the actual bindings.
    All in all, what I have done so far works as intended, except that when I want to add a row to the table it does not reflect, and that it only shows after refreshing/restarting the application.
    I will try and put together a reproducable sample.

  • How do I set only the first row of a DataGrid as the selected row?

    I have a "Go" button on a search form that fetches data into an already data bound grid.  After the data is fetched, I want to make the first row in the Datagrid the selected row, as if the user clicked on it.  If the result set is empty, I don't want the code to crash.  (I only want one row to be able to be selected at a time)
                protected function btnGo_clickHandler(event:MouseEvent):void
                    getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text);
                    grdSBJs. //  ?????  What goes here to select the first row?

    This should do it.
    If this post answered your question or helped, please mark it as such.
    if(myDataGrid.dataProvider.length > 0){
      myDataGrid.selectedIndex = 0;

  • DataGrid ItemRender and font family

    i am writing a custom data grid ItemRender that, for every
    cell, displays a numeric value. Additionally, if the xml data
    structure defines an attribute for a given row, it is supposed to
    display a colored arrow in the same cell.
    Reading the data and determining if to display the arrow, and
    the color of the arrow work fine. I am trying to embed the
    windgings font to display the arrow, that way I can set the color
    programatically. As I said, reading the data works fine, the
    coloring of the 'arrow' works fine. My problem is I cannot change
    the fontFamily of any label in the item renderer. Even the entire
    renderer itself. Below is my code, followed by several other things
    I have tried. Thanks for the help.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%" height="100%"
    implements="mx.controls.listClasses.IDropInListItemRenderer"
    horizontalScrollPolicy="off" verticalScrollPolicy="off">
    <mx:Style>
    @font-face
    src: local("wingdings");
    fontFamily: myArrowFont;
    font-anti-alias-type: advanced;
    font-weight: bold;
    .arrowStyle
    fontFamily: myArrowFont;
    font-weight: bold;
    font-size: 12;
    </mx:Style>
    <mx:Script>
    <![CDATA[
    import mx.controls.listClasses.BaseListData;
    import mx.controls.dataGridClasses.DataGridListData;
    protected var _listData:DataGridListData;
    public function get listData():BaseListData
    return _listData;
    public function set listData(value:BaseListData):void
    _listData = DataGridListData(value);
    invalidateProperties();
    override public function set data(value:Object):void
    super.data = value;
    cellArrow.setStyle('color',value[_listData.dataField].@color);
    switch(value[_listData.dataField][email protected]())
    case 'up':
    cellArrow.text = 'é';
    break;
    case 'down':
    cellArrow.text = 'ê';
    break;
    case 'equal':
    cellArrow.text = 'd';
    break;
    default:
    cellArrow.text = '';
    break;
    cellText.text = value[_listData.dataField];
    ]]>
    </mx:Script>
    <mx:Label id="cellText" text=""/>
    <mx:Spacer width="100%"/>
    <mx:Label id="cellArrow" styleName="arrowStyle"
    text=""/>
    </mx:HBox>
    I have tried using <mx:Label id="cellArrow"
    fontFamily='myArrowFont'/>
    I have set the fontFamily='myArrowFont' in the base HBox tag
    as well, and it doesn't change the font of either the cellArrow or
    cellText label.
    I have also used
    cellArrow.setStyle('fontFamily','myArrowFont') in the override set
    data method.
    I have written the same component in ActionScript
    implementing the same functionality.
    The cellArrow label's text and color are set correctly to the
    data, however I cannot get the font to change to windgings.
    I have tried setting the DataGridColumn fontFamily to the
    wingdings font, and all it does is change the header text of the
    column, not any of the rows.
    The actual datagrid is created entirely in actionscript,
    because it is part of a control that will build a datagrid with X
    number of columns, defined in a data structure. That code works
    fine as well, and is below, incase it helps.
    //_dataP is an XMLList from an httpservice or web service
    that defines our grids
    var colsX:XMLList = _dataP..column; //get an xmllist of our
    columns
    var len:int = colsX.length(); //and store the length
    var cols:Array = new Array(); //create an empty array to hold
    each column
    var col:DataGridColumn; //a data grid column reference
    for(var i:int = 0; i < len; i++)
    col = new DataGridColumn(); //create a new column
    col.headerText = colsX
    .@text; //set the header text
    col.dataField = colsX.@field; //and data field
    col.itemRenderer = new ClassFactory(quadBoxItemRenderer);
    cols.push(col); //add it to the array
    _grid.columns = cols; //set our columns array as the columns
    of the grid
    var rows:XMLList = _dataP..row;
    _grid.rowCount = (rows.length() == 0) ? 1 : rows.length();
    _grid.dataProvider = rows; //and give it the list of rows
    _grid.percentWidth = 100;
    _gridBox.addChild(_grid);
    any help is vastly appreciated. Thanks.

    Disregard my question - I've unfortunately failed to check the font-family string as submitted by the server and it turned out to still have a colon character in front of it...
    I guess I've spent a few too many nights working on this making me susceptible to tiredness and a strangely blank mind...
    My apologies,
    Rogier

  • Special characters into datagrid through the use of buttons

    Hi!
    I have a datagrid for word input, I'm trying to create a "special characters" panel, kind of like google's new "virtual keyboard" thing on google.com, so that the user can enter data into the datagrid cells using characters that aren't on their keyboards.
    I manage to do this just fine, using the solution below. I know this is probably not the best/most effective way to do this, so any suggestions for making the code better will be appreciated. I only started using Flex a month ago.
    grid.addEventListener(DataGridEvent.ITEM_EDIT_BEGIN, selectColumn)
    function selectColumn(event:DataGridEvent):void
    var selectedColumn:DataGridColumn = grid.columns[event.columnIndex];
    selCol = selectedColumn.dataField;
    //The function for adding a special character to the selected datagrid column by clicking a button:
    //(inputWordArray is the dataprovider for the grid called "grid" )
    protected function clickSomeButton(event:MouseEvent):void
    var colIndex:int = new int;
    if (selCol == "from"){
    inputWordArray[grid.selectedIndex].from = inputWordArray[grid.selectedIndex].from + "æ";
    colIndex = 0;
    else if (selCol == "to"){
    colIndex = 1;
    inputWordArray[grid.selectedIndex].to = inputWordArray[grid.selectedIndex].to + "æ";
    inputWordArray.refresh();
    grid.dispatchEvent(new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, false, colIndex, null, grid.selectedIndex));
    The problem is that this only adds a letter at the end of the selected item's value, not at a specific position within the word specified by the position of the cursor. This is what I need to achieve. I have no idea even what to search for, if anyone could please give me a hint that'd be great.

    You will probably need to capture the editor's selectionBeginIndex and
    selectionEndIndex

  • Flash 2.0 Datagrid component bug ?

    Recently I found a bug in Datagrid component. The swf file
    which contain datagrid act differely in IE 6, and IE 7.
    This is what I've done:
    1) Compile swf, export it together with html file.
    2) Run the html file
    3)Press on one of the cell,drag it and then release it
    outside of the browser/flash canvas.
    4)Move the mouse pointer back to flash canvas
    5)The grid will scroll automatically( move the move up and
    down to test)
    6)After a few times mouse pointer movement, suddenly IE
    crash, CPU usage 100%
    I have tested the swf file on firefox 2.007 and stand alone
    flash player, however, none of the flash player have this bug.
    Therefore I suspect that the ActiveX flash plugin for IE cause this
    bug.
    This is the source code, which I use to create the datagrid
    for testing.
    ps: open one fla file, drag datagrid component from component
    panel to the stage or it will not run.
    import mx.controls.DataGrid;
    var header = "Stock Code/\nName,Type,Status,Order
    Date\nTime,Duration,OrderQty/\nPrice,Matched Qty/\nPrice,Trd
    Curr/\nMatched Value,Account No/\nOrder No";
    var wid =
    "90,43.2699356842522,91.5969497381748,87.4747020181826,60.4473499934867,67.9851014914014, 90.2231829093762,111.8984058876167,134.104372277509";
    var alig = "left ,left, left , left , left , right , right ,
    right , left ";
    var halig = "center ,center,center , center , center , center
    , center , center , center ";
    var fxdata:Array = new Array();
    fxdata[0]= new Array("67676
    GPACKET","Buy","Expired","05/09/2007 06:04:20 PM","Day","200
    4.34","0 0.00","MYR 0.00","423423423432");
    fxdata[1]= new Array("054066
    FASTRAK","Buy","Expired","05/09/2007 01:45:18 PM","Day","47,900
    0.27","0 0.00","MYR 0.00","fdsfsdfsdf");
    fxdata[2]= new Array("737013
    HUBLINE","Sell","Expired","05/09/2007 11:53:19 AM","Day","400
    0.69","0 0.00","MYR 0.00","93743");
    fxdata[3]= new Array("31474
    L&G","Buy","Expired","03/09/2007 11:35:35 AM","Day","500
    0.70","0 0.00","MYR 0.00","389dskjfsd");
    fxdata[4]= new Array("38182
    GENTING","Buy","Expired","28/08/2007 11:38:59 AM","Day","500
    7.35","0 0.00","MYR 0.00","90sklsdakl");
    fxdata[5]= new Array("05005
    PALETTE","Buy","Expired","28/08/2007 11:08:23 AM","Day","500
    0.115","0 0.00","MYR 0.00","jsdaflk;as");
    fxdata[6]= new Array("093082
    GPACKET","Buy","Expired","27/08/2007 03:49:43 PM","Day","300
    3.82","0 0.00","MYR 0.00","jsdafj;sda");
    fxdata[7]= new Array("644769
    KELADI","Buy","Expired","27/08/2007 11:05:36 AM","Day","10,000
    0.30","0 0.00","MYR 0.00","jsadjf;lkdas");
    fxdata[8]= new Array("676653
    KASSETS","Buy","Expired","24/08/2007 06:15:33 PM","Day","500
    2.93","0 0.00","MYR 0.00","jlsdf;adas");
    fxdata[9]= new Array("473323
    JAKS","Buy","Expired","23/08/2007 04:45:03 PM","Day","100 0.915","0
    0.00","MYR 0.00","jjkljsdlfasd");
    fxdata[10]= new Array("03069
    IPOWER","Buy","Expired","22/08/2007 10:18:01 AM","Day","9,800
    0.365","0 0.00","MYR 0.00","jlajsd;lfjads");
    fxdata[11]= new Array("05025
    LNGRES","Buy","Expired","21/08/2007 03:08:06 PM","Day","9,900
    0.28","0 0.00","MYR 0.00","jlkjsdafl");
    fxdata[12]= new Array("01308 N2N","Buy","Expired","21/08/2007
    10:34:51 AM","Day","200 1.71","0 0.00","MYR 0.00","mjkjadsflasd");
    fxdata[13]= new Array("70069
    IPOWER","Buy","Cancelled","21/08/2007 10:02:08 AM","Day","0
    0.37","0 0.00","MYR 0.00","jkjasd;fsda");
    fxdata[14]= new Array("03069
    IPOWER","Buy","Cancelled","20/08/2007 07:20:54 PM","Day","0
    0.38","0 0.00","MYR 0.00","jkjsdlkfjsdaf");
    fxdata[15]= new Array("12651
    MRCB","Buy","Replaced","20/08/2007 05:31:59 PM","Day","900 2.35","0
    0.00","MYR 0.00","upuewoirwe");
    var mdtgrid:DataGrid;
    _root.createEmptyMovieClip("displayobj1",
    _root.getNextHighestDepth(),{_x:0,_y:0});
    initial();
    function initial(){
    _root.mdtgrid =
    _root.createClassObject(mx.controls.DataGrid, "xxx",
    _root.getNextHighestDepth());
    _root.mdtgrid.doLater(_root,"setData");
    function setData(){ //insert data to datagrid
    var temp:Array = new Array();
    for (var i in _root.fxdata){
    temp
    = new Object();
    for (var j in _root.fxdata){
    temp
    [j] = _root.fxdata[j];
    _root.mdtgrid.dataProvider =temp;
    _root.mdtgrid.doLater(_root,"setdgStyle");
    function setdgStyle(){
    var rowhight = 40;
    var noofrow = 8;
    var headerheight = 35;
    var gridheight = (rowhight * noofrow) + headerheight ;
    _root.mdtgrid.setSize(800, gridheight);
    _root.mdtgrid.rowHeight =rowhight;
    _root.setHeader(_root.header.split(","));
    _root.setWidth(_root.wid.split(","));
    _root.setAlign(_root.alig.split(","));
    _root.mdtgrid.invalidate();
    function setHeader(datasource:Array){ //set header label
    var leng:Number = _root.mdtgrid.columnCount;
    var sleng:Number = datasource.length;
    var temp:Object;
    for (i =0 ;i<leng;i++){
    if (i>=sleng){
    break;
    _root.mdtgrid.getColumnAt(i).headerText = datasource
    function setWidth(datasource:Array){ //set columns width
    var leng:Number = _root.mdtgrid.columnCount;
    var sleng:Number = datasource.length;
    var temp:Object;
    for (i =0 ;i<leng;i++){
    if (i>=sleng){
    break;
    _root.mdtgrid.getColumnAt(i).width = Number(datasource);
    function setAlign(datasource:Array){ //set Alignment
    var leng:Number = _root.mdtgrid.columnCount;
    var sleng:Number = datasource.length;
    var temp:Object;
    for (i =0 ;i<leng;i++){
    if (i>=sleng){
    break;
    temp = _root.mdtgrid.getColumnAt(i);
    temp.setStyle("textAlign",trim(datasource

    Anyone know how to fix it ?

  • Urgent help required to make variableRowHeight & rowCount work hand in hand for a Datagrid

    HI,
    I am using variableRowHeight property on a datagrid to wrap the text and this works perfectly.
    At the same time, I have to assign rowCount dynamically. My logic for caluculating rowCount is rowcount = sampleData.length > 5 ? 5:sampleData.length; where sampleData is my ArrayCollection. The caluculation happens correctly.
    The issue here is rows of the datagrid do not show correctly.
    From the post http://forums.adobe.com/message/2350643#2350643 I understood that both variableRowHeight & rowCount do not work hand in hand.
    So, I tried removing variableRowHeight and it works fine. The solution says using measureHeightOfItems and viewMetrics to calculate the height may solve the issue. I did not understand it very clearly.
    Can anyone let me know the solution with example.
    Thnaks
    Code
    =========
    <?xml version="1.0"?><mx:Application  xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()" xmlns:itemren="
    com.itemren.*">
     <mx:Script>
    <![CDATA[
     import mx.rpc.events.FaultEvent; 
    import mx.rpc.events.ResultEvent; 
    import com.vo.HeaderVO; 
    import com.vo.DataVO; 
    import mx.utils.ObjectUtil; 
    import mx.collections.IViewCursor; 
    import mx.controls.Alert; 
    import mx.collections.ArrayCollection; 
    Bindable] 
    public static var sampleData:ArrayCollection = new ArrayCollection (); 
    Bindable] 
    public var rowcount:int; 
    public function init():void { 
    sampleData.addItem( { AssetNo :
    "234567890", AssetName : "Asset Name 1", Amount : "10000.02" } );sampleData.addItem( { AssetNo :
    "234567891", AssetName : "Asset Name 2", Amount :"2.04" } );sampleData.addItem( { AssetNo :
    "234567892", AssetName : "Asset Name 3", Amount : "4578.00" } );sampleData.addItem( { AssetNo :
    "234567893", AssetName : "Asset Name 4", Amount : "384.00" } );sampleData.addItem( { AssetNo :
    "234567894", AssetName : "Asset Name 5", Amount : "21454.20" } );sampleData.addItem( { AssetNo :
    "234567890", AssetName : "Asset Name 1", Amount : "10000.02" } );sampleData.addItem( { AssetNo :
    "234567891", AssetName : "Asset Name 2", Amount :"2.04" } );sampleData.addItem( { AssetNo :
    "234567892", AssetName : "Asset Name 3", Amount : "4578.00" } ); 
    trace ("sampleData.length ========= "+sampleData.length); 
    rowcount = sampleData.length > 5 ? 5:sampleData.length;
    trace("count is ==== "+rowcount); 
    dg.rowCount=rowcount;
    trace("dg.rowCount is === "+ObjectUtil.toString(dg.rowCount)); 
    dg.dataProvider=sampleData;
    ]]>
    </mx:Script>
     <mx:Panel title="POC for dynamic rowCount of datagrid" height="100%" width="100%" paddingTop="
    10" paddingLeft="10" paddingRight="10"> 
    <mx:DataGrid id="dg" width="50%" wordWrap="true" variableRowHeight="
    true">
     <mx:columns>
     <mx:DataGridColumn dataField="AssetNo" headerText="Asset No" paddingLeft="20" />
     <mx:DataGridColumn dataField="AssetName" headerText="Asset Name" paddingLeft="20"/>
     <mx:DataGridColumn dataField="Amount" headerText="Amount" paddingLeft="20"/>  
    </mx:columns>
     </mx:DataGrid>
     </mx:Panel>
     </mx:Application>

    Hi,
    have you checked your bindings not only for the WF --> Method, also for the Method --> WF?
    Christoph
    Of course I mean the bindings between Task and Method / Method and Task
    Edited by: Christoph Schle on Dec 21, 2007 11:05 AM

  • How do I reference the data object in a DataGrid to show an image correctly in Acrobat?

    I'm creating an inferface for an Acrobat application  and I'm having a issue with displaying an image in a grid.  When I hard code the source="statusNONE.png" it works as intended (with an image, not the image associated with each grid item), however, when I try to use the source="{data.@icon}" to reference the dataProvider (XMLListCollection) I get nothing.  Not a broken image or anything.  I think I may just not be referencing the XMLListCollection correctly, otherwise I don't know why it would work with hard coding vs. fetching the string from the XML.
    //Application Header (Flex 4.5)
    <?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"
                                     width="100%" height="100%" creationComplete="eaton_creationCompleteHandler(event)"
                                     currentState="Review">
    //Sample of XML that gets used as basis for XMLListCollection
    <Annots>
         <Annot name='TEST' index='14' feedback='' canConstruct='0' icon='statusNONE.png'/>
    </Annots>
    //creation of the XMLListCollection from String
    [Bindable] protected var fullXML:XML;
    [Bindable] protected var fullXMLCol:XMLListCollection;
    protected function loadXML(xmlString:String):void
          fullXML = new XML(xmlString);
         var fullXMLList:XMLList = fullXML.children();
          fullXMLCol = new XMLListCollection(fullXMLList);
    //DataGrid
    <s:DataGrid left="0" top="0" bottom="0" width="142" dataProvider="{fullXMLCol}"
                                            requestedRowCount="4" rowHeight="30"
                                            top.Confirm="87">
                        <s:columns>
                                  <s:ArrayList>
                                            <s:GridColumn dataField="@name" headerText="Annotations"></s:GridColumn>
                                            <s:GridColumn headerText="status" width="30" >
                                                      <s:itemRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer>
                                                                                    <s:Image width="30" height="30" source="{data.@icon}"/> //THIS IS THE PART THAT SEEMS TO BE GIVNG ME TROUBLE!
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:itemRenderer>
                                            </s:GridColumn>
                                  </s:ArrayList>
                        </s:columns>
                        <s:typicalItem>
                                  <fx:Object dataField1="Sample Data" dataField2="Sample Data" dataField3="Sample Data"></fx:Object>
                        </s:typicalItem>
              </s:DataGrid>
    Additional information.  I'm using the resources tab for the flash embedding in Acrobat for my images. This works when I am hard coding the file name string works for the source without having to add a full path, the images are not technically bundled into the swf.   I just don't understand why using the data object to get that same string would show different results.
    tl;dr: GridItemRenderer works to show images when hard coded but not when using {data}.
    UPDATE: Figured it out, needed to add a toString() to the data.@icon.   I had assumed it was a string being handed over, I assumed wrong.

    Probably because data.@icon isn't a String, it is an XMLList, and source property is an Object not a String so the runtime doesn't automatically convert it.
      Try [email protected]()

  • Datagrid rearranging columns?

    I'm having a problem. This code i have written will import
    the XML but it rearranges the fields when i do this:
    "for (var subKey:String in data[0])"
    All of the fields come through but the subKey order is not in
    the order of the actual XML. Is there any way to get the
    "$ColumnNames[$w]" var from php over to flex in the same order?
    I don't know if i just reinvented the wheel, but it was
    definitely a good learning experience.
    MXML is first then PHP is second. Some of the code is copied
    off other examples. I didn't see any copyrights but let me know if
    there are any problems. O and the error thing doesn't work on the
    PHP page.

    I am look for a solution to a similar problem.
    I've got this nice little .fla that displays a DataGrid component (Flash CS3 Professional) using a DataProvider created from XML loaded from URLRequest/URLLoader (.asp source, but could be PHP, etc.).
    It works great except for one little annoying item.  The order of the columns seems to be totally arbitrary.
    I was expecting the order of the column to be the same as they occur in the XML DATA element.
    Here is a sample DATA element (there are serveral such DATA elements in the XML:
    <DATA>
      <AreaID>TNV</AreaID>
      <AreaName>TN, VA</AreaName>
      <MaxDvrHT>4</MaxDvrHT>
      <BoardName>TN, VA</BoardName>
      <RegionName>SOUTHEAST</RegionName>
      <salesGroup>David</salesGroup>
    </DATA>
    Here is the function that builds DataGrid:
    function returnAJAXcallback(evtObj:Event):void{
    // executed by URLLoader event listener "complete"
    // load the XML returned from .asp into XML object
    var myXML:XML = XML(evtObj.target.data);   
    // create a data provider from the XML
    var myDP = new DataProvider(myXML);  
    // create a DataGrid
    var myDataGrid:DataGrid = new DataGrid;  
    // set the data provider
    myDataGrid.dataProvider=myDP;   
    myDataGrid.width = 900;
    myDataGrid.height = 500;
    // show DataGrid on stage
    addChild(myDataGrid);     
    for each (var child:XML in myXML.DATA) {
      trace(child) ;  // list each DATA segment
    Here is the order that the columns appear in the DataGrid (left to right):
    AreaName
    RegionName
    salesGroup
    AreaID
    MaxDvrHT
    BoardName
    So, how in the world does Flash come up with this order?
    Why not default to the order in which the columns appear in the XML?
    Now, if some nice person knows the answer (I'm pretty new to Flash), what do I need to do (with as little code as possible) to get the columns ordered in a similar fashion to the order in which the XML data elements appear?
    Thanks to all.

Maybe you are looking for

  • Help to read TKPROF file in correct way

    Hi, I need help to understand what is going wrong. I have one query executed with different bind variables values. Case 1: Execution time is about 7.5 hours when :v6=:v3=:v4 (these are date bind variables values) Case 2: Execution time is about 2 min

  • Authorized versus Associated.....trying to share content

    What is the difference between a computer being AUTHORIZED to play content from an iTunes account versus a computer being ASSOCIATED with a device so it can be synced and play the content? It seems multiple computers can be AUTHORIZED to play content

  • Can't connect my MacBook Pro (2011) and the TrackPad.

    Hi, The TrackPad isn't recognized. Ran the firmware update - with no success. The TrackPad works fine with my iMac - same distance. Any suggestions?

  • Windows 7 on a MacBook Air

    Can I install Window 7 Professional on a boot camp partition on my 1.8/2GB/64GB SSD MBA?  I believe it is running OS 10.5.6 and is currently running XP Pro on a boot camp partition with the HD divided 50/50?  I was planning on booting from the periph

  • Strange glitch involving user accounts on my machine...

    Ok, this all started yesterday, I don't know if this is just some weird glitch or if it some sort of function I'm not aware of, that was suddenly activated. There is 2 user accounts on this computer, M(which is myself) and A(my mother)).My father was