DataGrid and XML with only 1 entry

Hi All,
I have a datagrid set up that is displaying an xml file.
Seems to work fine until there is only 1 entry in my xml file, then
I get no content displayed in the datagrid.
Here is my code that I am using for my app,
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" initialize="xmlDat.send()">
<mx:Script>
<![CDATA[
import mx.controls.dataGridClasses.DataGridColumn;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var myData:ArrayCollection;
private function resultHandler(event:ResultEvent):void{
myData = event.result.projects.project;
]]>
</mx:Script>
<mx:HTTPService id="xmlDat" url="data/whiteboard.xml"
result="resultHandler(event)"/>
<mx:Panel layout="absolute" title="Project Whiteboard"
height="600" width="1000" verticalCenter="-1"
horizontalCenter="-1">
<mx:DataGrid dataProvider="{myData}" width="980"
height="560" y="0" x="0" verticalScrollPolicy="on"
variableRowHeight="true" editable="false">
<mx:columns>
<mx:DataGridColumn headerText="Due Date"
dataField="dueDate" width="85"/>
<mx:DataGridColumn headerText="DVD ID" dataField="dvdId"
width="65"/>
<mx:DataGridColumn headerText="School Name"
dataField="schoolName" width="275"/>
<mx:DataGridColumn headerText="City" dataField="city"
width="100"/>
<mx:DataGridColumn headerText="St" dataField="state"
width="35"/>
<mx:DataGridColumn headerText="Qty" dataField="quantity"
width="45"/>
<mx:DataGridColumn headerText="Image Prep"
dataField="imagePrep" itemRenderer="render.imgRender"/>
<mx:DataGridColumn headerText="Video Prep"
dataField="videpPrep" itemRenderer="render.vidRender"/>
<mx:DataGridColumn headerText="Sequencing"
dataField="sequencing" itemRenderer="render.seqRender"/>
<mx:DataGridColumn headerText="FTP" dataField="ftp"
itemRenderer="render.ftpRender"/>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>

quote:
Originally posted by:
peterent
When there is only 1 entry in the result you don't have an
Array any more, you have a scalar. That's because the Player
doesn't know you intend or want to always have an Array.
Look up ArrayUtils and the toArray function. That should
help.
This sounds like just what I need. The only problem I am
having now is how to implement it into my code. When I add it to
the code it works for when I have one entry but if it is more than
that then no data shows.
Anyone have some ideas on this? Here is my updated code that
works for one entry in the xml but not more than that.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="initApp()">
<mx:Script>
<![CDATA[
import mx.controls.dataGridClasses.DataGridColumn;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.utils.ArrayUtil;
[Bindable]private var myData:ArrayCollection;
private var uintPollInterval:uint = 10000;
private var timer:Timer = new Timer(uintPollInterval);
private function initApp():void
xmlDat.send();
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
private function onTimer(event:TimerEvent):void
xmlDat.send();
timer.start();
]]>
</mx:Script>
<mx:HTTPService id="xmlDat" url="data/whiteboard.xml"
result="resultHandler(event)"/>
<mx:Panel layout="vertical" title="Project Whiteboard"
height="100%" width="1000" verticalCenter="-1"
horizontalCenter="-1">
<mx:DataGrid
dataProvider="{ArrayUtil.toArray(xmlDat.lastResult.projects.project)}"
width="980" height="100%" y="0" x="0" verticalScrollPolicy="on"
variableRowHeight="true" editable="false">
<mx:columns>
<mx:DataGridColumn headerText="Due Date"
dataField="dueDate" width="85"/>
<mx:DataGridColumn headerText="DVD ID" dataField="dvdId"
width="65"/>
<mx:DataGridColumn headerText="School Name"
dataField="schoolName" width="275"/>
<mx:DataGridColumn headerText="City" dataField="city"
width="100"/>
<mx:DataGridColumn headerText="St" dataField="state"
width="35"/>
<mx:DataGridColumn headerText="Qty" dataField="quantity"
width="45"/>
<mx:DataGridColumn headerText="Image Prep"
dataField="imagePrep" itemRenderer="render.imgRender"/>
<mx:DataGridColumn headerText="Video Prep"
dataField="videpPrep" itemRenderer="render.vidRender"/>
<mx:DataGridColumn headerText="Sequencing"
dataField="sequencing" itemRenderer="render.seqRender"/>
<mx:DataGridColumn headerText="FTP" dataField="ftp"
itemRenderer="render.ftpRender"/>
</mx:columns>
</mx:DataGrid>
<mx:ControlBar horizontalAlign="right">
<mx:Button label="Update" click="xmlDat.send()"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>

Similar Messages

  • I have two apple ID's, one with all my apps and one with only Mavericks. Will Mavericks update automatically if i'm not logged in to the apple ID I used to download it?

    I have two apple ID's, one with all my apps and one with only Mavericks. Will Mavericks update automatically if i'm not logged in to the apple ID I used to download it?

    Some things are mixed up here, seemingly...
    I seem to have two Apple ID's attached to my e-mail.
    An Apple ID is a valid email address, apparently. How can those be "attached to your email"... what email?
    Facetime will not verify my e-mail address because it is associated with the other account.
    This doesn't make sense. You can register multiple, even non-Apple-ID, email addresses and their aliases with FaceTime.
    So, maybe you can explain your problem better - what you want and the steps you've taken and what you have so far. If something doesn't work, please tell the exact error message, too.

  • Restore settings on iPhone 3G now it's turning on and off with only apple logo, please help me what do I do?

    Restore settings on iPhone 3G now it's turning on and off with only apple logo, please help me what do I do?

    Anybody there

  • Content based routing and XML with multiple objects

    I have some structure:
    <contracts>
      <contract>
         <department>1</department>
      </contract>
      <contract>
         <department>1</department>
       </contract>
      <contract>
         <department>2</department>
       </contract>
    </contracts>
    I need to route contract to 2 system based on <department> value:
    contracts/department = 1 --> System1
    contracts/department = 2 --> System2
    Will XI split my XML (based on Content Routing rules in ID) into 2 structures (with departmet=1 and department=2 accordingly) ?
    Or I have to perform 1ToN mapping? I don't like it bacause it will be diffucult to monitor hundred of messages.

    Alternatively if you donot like 1:n mapping and BPM.
    Create two message mappings in the IR
    1.Source :<contracts>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>2</department>
    </contract>
    </contracts>
    Target:
    <contracts>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>1</department>
    </contract>
    Basically mapping generates a target structure which has only department 1.
    2.Same like step1 but the mapping should generate the XML with department = 2.
    Once requires steps are done in the ID , do the content based routing in the reciever determination and give the appropraite message mapping in the interface determination.
    That should your problem and also you will like doing it as it does not involve any split level mapping..:)

  • I'm trying to decide whether to buy ipad or cheaper tablet.  What is retina display and what is diff betw ipad and mini with only wifi? What is mini missing?

    I'm trying to decide on tablet to buy -- what is the difference between mini and ipad?  What is retinal display?  Why do some have wifi only and some have wifi cellular?  Why would I need cellular?
    I keep hearing that apple computers don't pick up viruses like pc (of which I have had my fair share) so that is why I am considering -- but there are some really attractive deals for cheaper tablets.

    A simple answer to a loaded question?  Not here!
    1.     For starters, I can't recommend the newest iPad AIr or iPad Mini.  The previous versions worked perfectly though if you want to go the Apple route.  That alone will save you a few bucks.  Best Buy undercuts Apple prices by a few $$ and has bonus sales around this time of year.
    2.   You get what you pay for.  I like the Samsung Galaxy Tabs a lot.  Good hardware and software.  App store has plenty to offer.  You also have size options like you do with Apple.   Since I have the Galaxy S3 phone, the Galaxy tabs are very familiar.  The Surface (smaller one) is big for a tablet, it works great, but is subject to the frailties that plague PCs to some degree.   I don't like the keyboard, but do like the kickstand.   I don't know about the availability of Apps for the Surface, I think it may be a major downside to the device.  The Surface is not cheaper than iPad either.  As for the cheaper Tablets, they will be in the landfill before Apple introduces a new gadget (that's pretty often....)   The Kindle is still primarily, an eReader.
    3.   Wifi or wifi and cellular - If you have a smart phone and can tether a tablet, you don't need cellular on the tablet.  With more places offering free hot spots, wifi is more than adequate. ( I use very little cellular on my mini)
    4.    iTunes and the App store;  I will start by saying I am cheap.  If the App isn't free, it has to be really valuable to me or I won't buy it.  I paid for Pages on my iPad 2 years ago and I bought a password wallet that syncs on all my devices on all platforms.  Aside from that I buy music to add to the CDs I imported to iTunes.  If you don't like iTunes and don't want to use it, keep looking at android tablets.
    5.    ios 7 - Never has Apple made such a big deal and been so poorly prepared to introduce a new ios.  It has devoted Apple heads steamed.  I count myself one and have had no problems with my devices, educated user I hope, or just really lucky.
    6.    I really USE my tablet.  I use it for work, for financial management and communications.  I rarely have to resort to the desktop as almost everything is possible on the iPad.  I love it's portability!  Documents and data flow back and forth with the cloud I never worry about losing anything or finding anything.  Photos download automatically from my Android smart phone with Dropbox App and are instantly available to load on all devices.
    7.    If you are a big PC hacker type, the switch to ios is culture shock.  The first time on the new iMac I was at my wits end trying to navigate.  I only had to stop working so hard and it all fell into place.
    My personal experience:
        I have the iPad 2, (wifi only) and the first mini (with 4G LTE) and I had a 4th generation iPod touch and now have a 5th Gen iPod touch (which I really like a lot).  My son has an iPhone 4S and the iPad with retina display.  Both my sons have had iPods through the years.
       My 50 year old eyes prefer the bigger screen of iPad 2 and typing is much easier.  But I love the portability of the smaller tablet, so one for home, one for the road.  Thanks to iCloud what ever is on one is also on the other, documents, data, contacts, etc.   Retina display, my son has it, I don't, I can't say I miss it.  It does make pictures look better, if you are a photo person, the retina display is worth it.
    I also have transitioned from PC to Apple completely, I bought an iMac 4 years ago and it is as fast as it was on day one, no crashes, repairs, viruses.  I just bought a Mac Mini and I also use Apple Airport extreme for router and I have an Apple TV (the only disappointment, I prefer the Roku 2)
    I'm sure that was more than you asked for.....

  • Rescue and Recovery with only one partition, what will happen? Thanks!

    Hello, everyone! This is my question: If I do a clean installing of Windows 7 with only one partition(the C and I install the Rescue and Recovery tool, when I make a backup of the system by using the Rescue and Recovery then the backup file will be stored in the partition C:. So when I restore the system with the backup file later, if I can succeed and what will happen? Thanks.
    Solved!
    Go to Solution.

    Backups and restores will still work.  The risk is if something happens to your hard drive, then you would lose the backups as well.  For this reason it's a much better idea to store your backups somewhere else, such as USB hard drive or network.

  • DataGrid and Charts with dynamic XML

    First of all, forgive me if this has already been answered.
    The charting examples you see in the Flex documentation all
    use the same familiar ArrayCollection, and binds it to a DataGrid,
    Bar Chart, Area Chart, etc. However, all the grids and charts
    already know the structure of the data because the mxml contains
    field like yField="month" displayName="Month".
    What I am trying to do is make everything dynamic. I am
    converting an XML structure to an ArrayCollection and making it the
    dataProvider, but all I end up with is the column headers. The
    actual data doesn't populate the rows of the DataGrid.
    Beyond that. I want to take that same ArrayCollection I
    created from dynamic XML and use it as the dataProvider for any of
    the charts included with Flex Charting. Basically, a way to
    visualize the same data in any of the Flex charting components via
    a drop down.
    Has anybody got this to work?

    Without actually seeing the file, I would say check your
    content-type and make sure it is 'text/xml'.
    You can see examples of setting the content type here:
    http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html
    You can sometimes tell just by viewing the dynamic XML in the
    browser. If it shows as a XML tree, all is well. If it is a big
    blob of text, it's probably content-type...
    Let us know...
    Don

  • DataGrid  dataProvider XML with Namespaces,

    I have a DataGrid wich dataProvider is a XMLList. The problem
    is that, the xml has a default namespace, and in my DataGridColumns
    I use the dataField property to define wich XML field should be
    displayed. The problem is that the dataField property is used in a
    way that do not take into consideration the xml namespace.
    I'm already using the use namespace directive with the right
    namespace, but that doesn't work.
    Has anyone tried to do something similar?

    This is similar to a problem I stumbled into described in
    another post. What I ended up doing was creating a labelFunction
    for each column and using the value (without the namespace) as the
    element name. In ActionScript you can use the QName to get a child
    element:
    private function getItemValue(data:Object,
    column:DataGridColumn):String {
    return data.child(new QName(mb, column.dataField));
    Note that "mb" was a namespace variable I declared at a
    module level. I couldn't find a more elegant way of overcoming this
    namespace deficiency of the built in controls. I suppose you could
    also extend the DataGrid control, add a namespace attribute and
    override the appropriate function that provides the default
    rendering. However, that is something for another day.... Hope this
    helps.
    Dan

  • DataGrid and XML

    Can anyone spot a problem with the following code:
    <mx:Model id="readingData" source="reading.xml"/>
        <mx:ArrayCollection id="readingAC" source="{readingData.row}"/>
    <mx:DataGrid id="readingGrid" dataProvider="{readingAC}" x="10" y="40" rowCount="4" width="675" color="#000000">
        <mx:columns>
        <mx:DataGridColumn dataField="title" headerText="Title" width="200"/>
        <mx:DataGridColumn dataField="author" headerText="Author" width="200"/>
        <mx:DataGridColumn dataField="isbn" headerText="ISBN" width="200"/>
        </mx:columns>
    </mx:DataGrid>
    The error message I get is:
    Problem parsing external XML: C:\Documents and Settings\Ian\My Documents\RIA\src\reading.xml - (line 41) The entity name must immediately follow the '&' in the entity reference.    RIA_Prototype/src    Prototype.mxml  
    I have another DataGrid in the app. which works just fine but this one won't - and I don't understand the error message.
    Ian

    Hi Alexander the xml file:
    <?xml version="1.0"?>
    <reading>
        <row>
            <contactid>1</contactid>
            <title>My Sisters Keeper</title>
            <author>Jodi Picoult</author>
            <isbn>978-1-439-15726-8</isbn>
        </row>
        <row>
            <contactid>2</contactid>
            <title>Fearless Fourteen</title>
            <author>Janet Evanovich</author>
            <isbn>978-0-312-34952-3</isbn>
        </row>
        <row>
            <contactid>3</contactid>
            <title>Dead Until Dark</title>
            <author>Charlaine Harris</author>
            <isbn>9780441016990</isbn>
        </row>
        <row>
            <contactid>4</contactid>
            <title>From Dead to Worse</title>
            <author>Charlaine Harris</author>
            <isbn>978-0-441-01701-0</isbn>
        </row>
        <row>
            <contactid>5</contactid>
            <title>Wed Him Before You Bed Him</title>
            <author>Sabrina Jeffries</author>
            <isbn>978-1-416-56082-1</isbn>
            </row>
        <row>
            <contactid>6</contactid>
            <title>Sail</title>
            <author>James Patterson</author>
            <isbn>9780446536103</isbn>
        </row>
        <row>
            <contactid>7</contactid>
            <title>The Last Oracle</title>
            <author>James Rollins</author>
            <isbn>978-0-06-123095-0</isbn>
        </row>
        <row>
            <contactid>8</contactid>
            <title>Angels & Demons</title>
            <author>Dan Brown</author>
            <isbn>9781416524878</isbn>
        </row>
        <row>
            <contactid>9</contactid>
            <title>Sundays at Tiffany’s</title>
            <author>James Patterson</author>
            <isbn>978-0-446-53631-8</isbn>
        </row>
        <row>
            <contactid>10</contactid>
            <title>Living Dead in Dallas</title>
            <author>Charlaine Harris</author>
            <isbn>978-0-441-01824-6</isbn>
        </row>
        <row>
            <contactid>11</contactid>
            <title>The Last Patriot</title>
            <author>Brad Thor</author>
            <isbn>978-1-416-54384-8</isbn>
        </row>
        <row>
            <contactid>12</contactid>
            <title>Rogue</title>
            <author>Danielle Steel</author>
            <isbn>978-0-440-24329-8</isbn>
        </row>
        <row>
            <contactid>13</contactid>
            <title>Club Dead</title>
            <author>Charlaine Harris</author>
            <isbn>9780441010516</isbn>
        </row>
        <row>
            <contactid>14</contactid>
            <title>Dead to the World</title>
            <author>Charlaine Harris</author>
            <isbn>978-0-441-01218-3</isbn>
        </row>
    </reading>

  • C/C++ and XML with 8i?

    Hi,
    Just give me a few guidelines to help me starting : I would like to provide an XML interface to my database, using C or C++ code. (ie, extract query results and generate XML output, and store XML documents in the database). All parts in the whole project are C and C++ (no java anywhere), and I would like to keep it like this.
    All this is using 8iR2, under RH6.2. What tools and/or API should I use? Till now, I can only find APIs, samples, documentation, etc, relative to java...
    Thanks,
    CJ.

    Currently you can only materialize XML from SQL Queries via Java or PL/SQL using our XML SQL Utility. There are no C/C++ total solutions at this time.
    Oracle XML Team
    null

  • HT4061 my iphone 4 is frozen with the itunes logo and a plug in sign on it. i tried to restore it...waited over 1.1/2 hours since the first time it reset and restarted with only 30 min to go. it said it was done but still is frozen! help, i cant get the s

    i had a third update showing on my iphone 4, i had already updated to the 07 and downloaded the second update to help fix bugs etc. the second update only took a few minutes unlike the first original update that took 4 1/2 hrs! when i saw the third updade i plugged in the phone, connected to wifi and hit update. it showed the apple sign and the bar underneath showing the progress. i left the phone to do its thing and when i went to get it about 1/2 later the phone had a itunes logo and and a picture of a charger showing. it would not do anything. it was frozen. i looked up online how to fix it. it told me to connect to itunes and then to restore. it would make sure that i could keep my contacts and pictures. the restore took 3 hrs, as it started at 78 min which actually took way longer, then when there was only 30 min left it stopped and went back to the "do you want to restore" question and i had to start all over. when it was finally done, i still have the itunes logo and its still frozen..please help!

    See Here for
    Unable to Update or Restore
    http://support.apple.com/kb/HT1808

  • How to install and runRMS with only Oracle jdeveloper

    Dear sir/madam,
    Iam totally new to java and jsp.I have downloade Ur RMS project.I want to run ur RMS project using only Oracle J developer.Is it possible to run this using only J developer.Or do i require any other software.Pls give me the detailed instructions to run it using Jdeveloper.
    Thanks
    Naveen

    java developer by right can run on its own

  • Aperture exports Events to iPad, iPhoto and iWeb with only first picture

    I have an issue with publishing photos to iPad, iPhone and iWeb from Aperture. When I want to publish photos I do find list of all Events in the device like in Aperture Library but each Event contains just the first photo. The remaining photos are absent although I can find them among all the pictures in the Photo Browser. This indicates that the photos have been transferred to the device but for some reason not included in the Events.
    In Aperture each Event opens with all the photos contained. Did I miss something in the setting of Aperture or the device?
    Milan

    This problem is still ongoing.... Having synced my entire library to my iPad, not having projects in date order is a real pain - and makes finding a certain project very tedious.
    Does anyone have any kind of fix for this yet?
    Alexander, in what way did Apple acknowledge this problem?
    Thanks,
    David

  • Can i get all my application i purchase, since my iphone firmware software crash and hang with only apple logo, can i get all my application i purchase, since my iphone firmware software crash and hang with only apple logo

    can i retrieve all my application, document store on my notes, and and my picture from my iphone. since my iphone firmware is crashed.
    many thanks for your advice.

    To change the iCloud ID you have to go to Settings>iCloud, tap Delete Account, provide the password for the old ID when prompted to turn off Find My iPhone (if you're using iOS 7), then sign back in with the ID you wish to use.  If you don't know the password for your old ID, or if it isn't accepted, go to https//appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Tap edit next to the primary email account, tap Edit, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iPhone on your device, even though it prompts you for the password for your old account ID. Then go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https//appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

  • Cut and paste with Fascinate

    Anybody know how to cut and paste text with Fascinate?

    I haven't been able to get it to work everytime, but like in text's, just touch and hold at the beginning or end of where you would like to copy. Then, after a moment, a box will open up with options to select text, select all text, and a couple of others. If you only want to select a portion of it, just select, select text, and and then with only one finger at a time, move the highlight field to cover what you want to select. When you're done highliting, press and hold again, and select copy. Then go to where ever you would like to paste it, and press and hold the screen again, and select paste, and it will insert the text that you copied. It doesn't work the best, and like I said too, not in all areas of the phone.

Maybe you are looking for

  • How to create my own Key for Rijndael (JCE Criptix)?

    I am developing a communication protocol and the key for encryption and decryption should be the user's password. This method generates a new RANDOM key: kg = KeyGenerator.getInstance("Rijndael"); kg.init(256); k = kg.generateKey(); The problem is th

  • CUVA with Win 7 (32 Bit and 64 Bit) OS

    Hi All, Our users are facing issues with CUVA 2.1.2.0 [ CDP 2.1(0.6) ] with Windows 7 32 Bit and 64 Bit. On Windows 7 the CDP Driver and version is visible but not on Windows 7 64 Bit. On both the operating systems, users are not able to access the C

  • Apache FOP: reducing/reclaiming memory?

    FOP does a marvelous job in generating documents, indeed. However, the memory footprint is also extraordinary (especially for larger documents). What's the most secure way to clean up fop and reclaim all memory fop used (if possible)?

  • Adobe 8.1.2. : cannot remove older version

    Here in Finlad we have several Adobe reader users, which cannot install the newest Adobe reader version. In the end of install the installer says (free translation) "Cannot open the installer pack... The older version cannot reinstall... take contact

  • Importing into Organizer issue

    I get error messages when trying to load pictures into Organizer from iphoto or files