A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Populate a datagrid from an internal array

  1. #1
    Random logic?
    Join Date
    Oct 2000
    Posts
    410

    Populate a datagrid from an internal array

    Hi. Is it possible to populate the datagrid from an internal array, rather than an external xml file?

    M@)

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    suppose your datagrid component has instance name "empData" then use the following to populate it:


    Code:
    var aEmployees:Array = new Array(
        {Name:"John", Job:"Director", Salary:"21000"},
        {Name:"Alex", Job:"Clerk", Salary:"43000"},
        {Name:"Nathan", Job:"Manager", Salary:"84000"}
    );
    
    empData.dataProvider = aEmployees;
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    Im using flash pro 8 - where can I download a data grid component? Can you send me an example? M@)

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    Look in your components panel and the in UI Components..should be there...(at least for mx 2004)
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  5. #5
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    Ace - thanks

  6. #6
    Random logic?
    Join Date
    Oct 2000
    Posts
    410
    Can a data grid component be efficiently connected to a text file for population?

  7. #7
    Junior Member
    Join Date
    Jun 2006
    Posts
    1
    I seem to have some similar problems populating my datafield.

    //I use ->MDM Zinc the mdm.Database.MSAccess are extras thus.

    PHP Code:
    _root.mdm.Database.MSAccess.select("SELECT * FROM inv_list WHERE order_status='New Request'");

    var 
    maq _root.mdm.Database.MSAccess.getRecordCount();
    var 
    dataSet mdm.Database.MSAccess.getData();

    mdm.Dialogs.prompt(maq)

    var 
    chicken:Array = new Array();

    for (
    i=0;i<maq;i++){ //dataSet[row][column] how its read.
    chem dataSet[i][1];
    supp dataSet[i][8];
    catn dataSet[i][9];
    odat dataSet[i][11];
    osta dataSet[i][10];

    chicken.push({chemical:chemsupplier:suppcatalogue_number:catnorder_date:odatorder_status:osta});

    //mdm.Dialogs.prompt(chicken.length) 
    //mdm.Dialogs.prompt(chicken)
    }
    AAmount maq;
    for (
    q=0q<AAmountq++){
    var 
    aj chicken[q] ;
    var 
    whats aj.chemical;
    var 
    whats1 aj.supplier;
    var 
    whats2 aj.catalogue_number;
    var 
    whats3 aj.order_date;
    var 
    whats4 aj.order_status;
    mdm.Dialogs.prompt(whats+","+whats1+","+whats2+","+whats3+","+whats4)
    //the above prompts the info in the array correct, its there!
    }
    myDPF.dataProvider chicken//gives me the right headertext but no data. 
    Why is there no data? your time and effort is appreaciated!!


    *Using Flash 8.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center