Array to grid works but need some help. Please help the beginner...

Hi,
I'm very green at this...
I've been trying to display a two-dimmensional array on a dataGrid and finally found some code that I was able to modify to my needs.
However couple things I don't understand.
1. Do I need the <s:itemRenderer>...</s:itemRenderer> section to display the data? Can this be simplified?
   I don't need to change the default look of the columns etc. However it looks like the grid will not populate without that prepare() function.
   Why isn't this sufficient to populate the grid? -> dataGrid.dataProvider = new ArrayCollection(dataArray);
2. The number of columns is hardcoded (3) and their headings are as well (N1, N2, N3).
   Can I show/hide columns at runtime based on number of columns in my array?
   Can I rename the column's headings at runtime?
Thanks,
Tom
here's the code:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
  xmlns:mx="library://ns.adobe.com/flex/mx"
  xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import spark.components.gridClasses.CellPosition;
            import spark.components.gridClasses.CellRegion;
            // Create a dataProvider whose items are arrays of 6 random numbers. 
            // The DataGrid's item renderer will display item[columnIndex].
            private function initializeDataProvider():void
                const nRows:int = 10;
                const nCols:int = 3;
                const dataArray:Array = new Array(nRows);
                for (var row:int = 0; row < dataArray.length; row++)
                    var values:Array = new Array(nCols);
                    for (var col:int = 0; col < values.length; col++)
                        values[col] = Math.round(Math.random() * 10);
                    dataArray[row] = values;
                dataGrid.dataProvider = new ArrayCollection(dataArray);
        ]]>
    </fx:Script>
    <s:DataGrid id="dataGrid" selectionMode="singleRow" initialize="initializeDataProvider()">
        <s:itemRenderer>
            <fx:Component>
                <s:DefaultGridItemRenderer>
                    <fx:Script>
                        <![CDATA[
                               override public function prepare(hasBeenRecycled:Boolean):void
                               label = data[columnIndex];
                        ]]>
                    </fx:Script>
                </s:DefaultGridItemRenderer>
            </fx:Component>
        </s:itemRenderer>
        <s:columns>
            <s:ArrayList>
                <s:GridColumn headerText="N1" width="50"/>
                <s:GridColumn headerText="N2" width="50"/>   
                <s:GridColumn headerText="N3" width="50"/>   
            </s:ArrayList>
        </s:columns>
    </s:DataGrid>
    <s:Button id="cmd" x="128" y="502" width="122" label="Button" click="initializeDataProvider()"/>
</s:View>

Hi fouriron,
Does this help?
Formula in E2 (and Fill Down)
=IF(D2<10,10, D2)
If a value in column D is less than 10, then insert 10, else insert the value from column D
The "correct" value (SUM) is in  column D
The "required" Answer is in column E
Regards,
Ian.

Similar Messages

  • TS1702 I need some help the apps were downloading slowly

    The apps downloaded but it didn't cause it's stuck in downloading mode what should I do?
    The iOS 6 update didn't work.
    Please I need some help.
    The apps didn't download.
    Talking Angela and Ginger didn't download.
    Talking Santa didn't update.

    Try moving the existing backup file to a safe location so that iTunes has to create an entire new file.  The backup file is located here. You can delete that backup once you get a successfull backup.
    iTunes places the backup files in the following places:
    Mac: ~/Library/Application Support/MobileSync/Backup/
    Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    Windows Vista and Windows 7: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    Note: If you do not see the AppData or Application Data folders, you may need to show hidden files (Windows XP,  Windows Vista and Windows 7), or iTunes may not be installed in the default location. Show hidden files and then search the hard drive for the Backup directory.

  • Simple SAN configuration but need some help

    Hi,
    We have a little San configuration with 6 clients (G5) one MDC (XS G5) and 1 XSR 5.6 TB. XSan 1.2 / MDC and all machine 10.4.3 and 1 in 10.4.4
    Our clients are of two types :
    Two of them have only 1 local user account with admin privileges
    Four of them have 2 local accounts (one with admin privileges, the other normal)
    I just want that all people can access (read & write) the entire volume and folders.
    I don't want to use LDAP for that for some reasons (I want a local user on our FCP editing machines, and already have LDAP for other purposes and don't want to mix the problems).
    Here is my problem : when I copy some files from a client with admin user account, I don't have the write access to theses fils from a client with normal user account....
    but when I'm logged with admin, it works fine.
    How does XSan work for authentification and what I have to do to make my little system work ?
    Thank for your help
    Marcello
    all   Mac OS X (10.4.4)  
    all   Mac OS X (10.4.4)  
    all   Mac OS X (10.4.4)  

    The Xsan Quick-reference Guide from Peachpit Press is a good place to start. As I understand it, each computer should have the same list of users, in the same order. e.g. admin,edit1, edit3 etc. They should be entered in the same order so that their 'uid' is the same on each computer i.e. 501, 502, 503, although I think 'netinfo manager' goto 'users' lets you change the uid number.
    Once this is done, then use 'Tinkertool' application, to change 'permissions' the checked 'don't allow' to unchecked will then allow any user to read/write anything else written to the raid.

  • Considering switching to mac but need some help

    Sorry if this is inappropriate for this forum or section. Wasn't sure where else to post. My pc finally died and am tired of viruses, pc problems etc, so I got the green light for a mac from my wife (thinking of a mini). My question is how do I get all my backed up data on my western digital my book (pc formatted) onto my new mac? Is it possible?
    I was thinking it is since I've read that macs can run windows. Theoretically I would think that if I turned the mac in windows and plugged my My book external drive, it should recognize it, right?

    The Mac should recognize your drive without dealing with installing Windows.
    If your data that is backed up is just in folders, etc, then why even mess with windows? I thought the whole idea was to get away from the PC virus issues and stuff.
    Mac's can *read and write* to PC drives that have been formatted with Fat32 (common with Win98, XP and most external drives) and they can read drives that have been formatted with NTFS (common with XP internal drives). After you get your data off of the drive, you can use Disk Utility to change the partition type to HFS+ and format the drive for Mac's and Time Machine or just use it with Fat32 for transferring files to PC's etc.
    You mount the drive by plugging it in, it shows up on the Mac desktop, drag the files onto your Mac and put them in the proper folders or make new ones.
    If your files are standard computer files like PDF's, Doc's, Jpg's, then they will open with MacIntosh versions of the programs you used on the PC or other programs specific to the Mac. In the PDF example, I don't even install Adobe Acrobat Reader on a Mac (who needs the security issues) and use Apple's Preview program instead.
    For my clients who are switchers, there are usually only two programs in common use on a PC that are a problem for Mac's - The PC version of Quickbooks is better and there is no MS Access Database program for the Mac. There are Mac versions of almost all of the most common PC programs, or excellent replacement programs for the Mac. Programs are easy to deal with, it's the data that you can't replace.
    Deal with Windows if you have to, but many don't and use their files and hardware anyway...
    Hope this helps.

  • Unzipping files - works, but need some hlp to make it better

    Hi there!
    I am trying to unzip files using java.util.zip
    My code works If I have a parent directory for all files/folders.
    So when I unzip the structure is as -
    zipFileName -> parent folder -> child files/folders
    where, zipFileName and parent folder names are same.
    But I want to have it as
    parent folder -> child files/folders.
    Here is my code :
    public void unzipFiles(String zipFileName, String zipFolderPath, String unzipPath) {
    Enumeration entries;
    ZipFile zipFile;
    try {
    //Set up a directory name for the unzipped files
    String courseFolderName = zipFileName.substring(0, zipFileName.indexOf("."));
    //Get the zip file from its location in the "zip" folder on theServer
    String separator = File.separator;
    zipFile = new ZipFile(zipFolderPath + separator + zipFileName);
    //Set up the directories in the data store
    entries = zipFile.entries();
    while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry)entries.nextElement();
    if (entry.isDirectory())
    String dir = entry.getName();
    System.out.println("entry :"+unzipPath + separator + courseFolderName + separator + dir);
    checkFilePath(unzipPath + separator + courseFolderName + separator + dir);
    unzippedFolders.addElement(courseFolderName + separator + dir);
    //Add the unzipped files to the data store
    entries = zipFile.entries();
    while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry)entries.nextElement();
    if (entry.isDirectory())
    continue;
    if (debug)
    System.out.println("Extracting file: " + entry.getName());
    copyInputStream(zipFile.getInputStream(entry),
    new BufferedOutputStream(
    new FileOutputStream(unzipPath + separator + courseFolderName + separator + entry.getName())));
    zipFile.close();
    catch (IOException e) {
    e.printStackTrace();
    catch (Exception e) {
    e.printStackTrace();
    [\code]
    The above code works if the zip file is having all files under a parent folder:
    zipFileName -> parent folder -> child files/folders
    sample output:
    unzipping the files...
    entry :C:\DataStore\template\test2/IMAGES/
    Creating directory C:\DataStore\template\test2/IMAGES/
    entry :C:\DataStore\template\test2/INPUTS/
    Creating directory C:\DataStore\template\test2/INPUTS/
    otheriwse, if I have no levels under my zip level, I get an error like this:
    unzipping the files...
    Extracting file: schedule.htm
    Extracting file: IMAGES/AMTC.GIF
    java.io.FileNotFoundException: C:\DataStore\schedule\IMAGES/AMTC.GIF (The system
    cannot find the path specified)
    Can somebody pls help me find out where I am going wrong. Any help would be really really great.
    Thanks
    -Mahi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    I don't know if this will help but... If I understand correctly, is not
    recreating the correct directory tree?
    // unjar the jar to the destination directory destdir
    // destdir = c:\mydir\ is prepended to each jar entry
    JarFile jarFile = new JarFile( "myjar.jar" );
    Enumeration e = jarFile.entries();
    while( e.hasMoreElements() )
    JarEntry entry = (JarEntry)e.nextElement();
    File localFile = new File( destdir + entry.getName() );
    ---> // peel off the parent path and make as directories
    ---> File directory = new File( localFile.getParent() );
    ---> directory.mkdirs();
    // these can be inlined if desired
    FileOutputStream fileOutputStream = new FileOutputStream( localFile );
    BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( fileOutputStream );
    copyInputStream( jarFile.getInputStream( entry ), bufferedOutputStream );
    jarFile.close();

  • I just got BT Infinity but need some help!

    Hello everyone just joined the infinity club! new to BT! *waves" moved from BE* well i have a slight problem the engineer has came and all is installed and working well but I am not getting the quoted speed of 80mb download and 20mb Upload. I phoned BT up and was told it could take up to 24hours but the line came on fine and seems to be stuck with the old profile of 40mb download and 10mb upload (from what i read on the forums that was the old speed) line is very stable and pings are low.  just wanted to double check if i should be worried at all since when it comes to customer support i never have much trust for overseas call centres!

    Zerolimitz wrote:
    Hello everyone just joined the infinity club! new to BT! *waves" moved from BE* well i have a slight problem the engineer has came and all is installed and working well but I am not getting the quoted speed of 80mb download and 20mb Upload. I phoned BT up and was told it could take up to 24hours but the line came on fine and seems to be stuck with the old profile of 40mb download and 10mb upload (from what i read on the forums that was the old speed) line is very stable and pings are low.  just wanted to double check if i should be worried at all since when it comes to customer support i never have much trust for overseas call centres!
    Hey thanks for the quick reply!
    I just got this message when i tried:
    Sorry, our records show there's already an existing order for this phone line. Please check your details and if entered correctly, call us on 0800 121 8085 to speak to an advisor for help. Lines are open Monday to Saturday 7.30am-10pm and Sunday 9am-6pm.

  • I'm using an iMac (latest) & need Adobe Flash to work but for some reasin after downloading the latest version it still doesnt work - plse advise

    I'm using the latest iMac & have downloaded the lates Adobe Flash player & installed it but it seems still not to work with Firefox - plse advise what to do so it can work in Firefox 3.6.13

    RE Skype for Linux.
    Yeah, me too, am running 64 bit LinuxMint 16, I have tried Firefox and Chrome and tried to download any/all of the Linux variants but nothing happens, I have allowed pop ups and disabled security, still nothing. I have tried downloading any/all of the linux versions onto my Asus ROG laptop running windows 8 and do a file transfer - still nothing. So I have to conclude the page is broken ?? Pretty poor really.
    Stratixman.

  • I want to start but need some help

    Hi
    I am new to java. I want to ask you where I write the java code?? I want to work in J2SE platform, what are the s/w that I should download to allow me write and compile a code "the complete name of the softwar and the link if it is available on the web plzzz".
    thank you

    For the tools/software you can go to
    http://www.eclipse.org
    and then immediatly to this link
    http://java.sun.com/docs/books/tutorial/information/download.html
    in order to download a tutorial for the java language itself.
    Have fun !

  • Not a genius i need some help

    my husand received a ibook from a customer as a form of payment for some work he did. It works but need some help trying to figure out some things any help will be appreciated. We received it with a admin password so i rebooted it with my new mac os x 10.5.4 to set our own admin password. I can connect to internet with my cable modem no problem however it will not let me open yahoo! it says not a supported browser so i click safari 5 to download and it then tells me that bill of materials is missing any ideas? when i load my mac os x disk it will not load just spins in tray all cds work so dont know why it won't run. It occassionally tells me that classic doesnot have mac os 9 supported?Also any updates i need from this info would also help me out. thank you.
    mac os x version 10.3.9 processor 300 mhz PowerPc G3/powerPc 750 (83.2) memory 192 MB L2 Cache 512 kb bus speed 67 Mhz boot rom version 3.2.4f1
    ata-4 bus: Toshiba 5.59GB revision N2.10c OS9 drivers:Yes
    Safari 1.3.2
    I hope any of this helps. Not really wanting to invest alot of money to do modifications just want to be able to do simple tasks like:itunes check email etc

    HI and welcome to Apple Discussions...
    Try repairing permissions.Launch Disk Utility. (Applications/Utilities) Select MacintoshHD in the panel on the left, select the FirstAid tab. Click: Repair Disk Permissions. When it's finished from the Menu Bar, Quit Disk Utility and restart your Mac. If you see a long list of "messages" in the permissions window, it's ok. That can be ignored. As long as you see, "Permissions Repair Complete" when it's finished... you're done. Quit Disk Utility and restart your Mac.
    And since you don't the original install disc, boot in Safe Mode to make sure the startup disk is ok.
    Instructions for starting up in Safe Mode
    What is Safe Mode
    It occassionally tells me that classic doesnot have mac os 9 supported?
    The original owner probably had the Classic environment installed (Mac OS 9).
    For software updates, click the Apple Menu / Software Update...
    Carolyn

  • Hi, Someone Know why my charger is not working properly but always it was been working good but now when conect my iphone (3gs) shows a yellow triangle saying : Charging is not supported with this accessory. Please I need some help here. Thanks =D

    Hi Someone Know why my charger is not working properly but always it was been working good but now when conect my iphone (3gs) appears a golden triangle saying :Charging is not Supported with this accessory. Please I Need Some Help Here. Thanks =D

    sounds like the cable or the iphone connector are somehow damaged

  • Hi i need some help im having problems the ipod can not be turned , in fact it was working fine but suddenly switched off and did not return to light n because it reconnected and if I had drums

    hi i need some help im having problems , the ipod can not be turned , in fact it was working fine but suddenly switched off and did not return to light n because it reconnected and if I had drums  . what can i do to turned on .
    its an ipod touch 64gb

    That symptom is covered here:
    iPod touch: Hardware troubleshooting

  • Remote App on iPad connects but drops after about  20 mins. Need to turn  off wait about 1 minute then turn on wifi on iMac before it can reconnect. Need some help please.

    Remote App on iPad connects but drops after about  20 mins. Need to turn  off wait about 1 minute, then turn on wifi on iMac before it can reconnect. Need some help please.
    Already gone through troubleshooting guide a zillion times. Thanks.

    This worked for me... A little time consuming but once you get rolling it goes GREAT... Thanks....
    I got my artwork and saved it to my Desktop
    Opened up Microsoft Paint and clicked on "File" and "Open" and found it to get it on the screen to resize it
    Clicked "resize" and a box for changing it opened up
    Checked the box "Pixels" and "Unchecked maintain aspect ratio"
    Set Horizontal for 640 and Vertical for 480
    Clicked on "OK" and went back to "File" and did a "Save As" and chose JPEG Picture
    It came up "File Already Existed" and clicked "OK" (really did not care about the original artwork I found because wrong size)
    Went to iTunes and on the movie right clicked on "Get Info", clicked on "Details", then "Artwork"
    Go to the little box on the top left that shows your old artwork and click on it to get the little blue border to appear around it and hit "Delete" to make it gone
    Click on "Add Artwork" and find it where you put the one from above on your Desktop and hit "Open" and OK and your new artwork is now there and all good.
    Sounds like a lot of steps to follow but after around 5 or so you will fly through it. This worked perfect on my iPhone 6 Plus and I have artwork on my Home Videos now.

  • I am currently using an ipod touch 3. When i record in voice memos with the apple earphones(with an inbuilt mic) i can see on the screen that its recording; but when i hear it, its just a long beep. Need some help!

    I am currently using an ipod touch 3. When i record in voice memos with the apple earphones(with an inbuilt mic) i can see on the screen that its recording;
    but when i hear it, its just a long beep. Need some help!

    Does the mic work for other apps like Voice Control?
    Does the mic work OK in other devices?
    Have you tried it with another mic?
    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.
    -  Make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar

  • Need some help: my itunes won't sync with my iphone anymore. Both softwares are up to date and I've reinstalled itunes. After I reinstall, it syncs. But then when I reboot my computer, it no longer syncs anymore and I have to keep reinstalling itunes. Tho

    Need some help: my itunes won't sync with my iphone anymore. Both softwares are up to date and I've reinstalled itunes. After I reinstall, it syncs. But then when I reboot my computer, it no longer syncs anymore and I have to keep reinstalling itunes. Thoughts???

    thought that it was possible to have the same iTunes library on any machine that was authorised, a kind of cloud-iTunes I guess. 
    That would convenient, but sadly it is not the case. Sorry!
    Either way your welcome and best of luck!
    B-rock

  • I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated.

    I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated. Heres an image of before and after. The first image I use is a JPG 72dpi 1500px x1500px and I want to downsize it to 600x600px same res, but it keeps pixelating, this has never happened before. Any suggestions, thoughts?
    thanks!

    I wouldn't say pixelated; more like blurry.
    Like ConnectedCreative said, what steps are you using? Are you using "bicubic sharper" when resizing down?

Maybe you are looking for