Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 703361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:49:22+00:00 2026-05-14T03:49:22+00:00

I have a custom dataGrid that acts more like a 2D list (if that

  • 0

I have a custom dataGrid that acts more like a 2D list (if that makes sense at all). I am dynamically creating the columns and recreating the dataProvider to suit my needs. While debugging I can see that I am creating the columns and setting them to the dataGrid and creating and setting the dataProvider, but for some reason I am able to see the dataGrid and the columns but not the data.

[Bindable]
private var mockData:ArrayCollection = new ArrayCollection([
{value: "425341*"},                     
{value: "425341*"},                                                 
{value: "425341*"},
{value: "425341*"},
{value: "425341*"},                                         
{value: "425341*"},                                             
{value: "425341*"},                                     
{value: "425341*"},                                         
{value: "425341*"}]);

        ...

<TwoDimensionalList 
    width="100%" height="100%"
    numColumns="7" numRows="7"
    dataField="value" 
    dataProvider="{mockData}"/>

The snippet of code from the object only contains the important functions, everything else is not important (getters, setters, etc …).

While debugging I checked all the variables in the functions to make sure they were assigned and a value that I was expecting.

[Snippet]

public class TwoDimensionalList extends DataGrid
{

    ...

    /**
    * Creates and sets properties of columns
     */
    private function createColumns():void
    {
        var column:DataGridColumn;
        var cols:Array = this.columns;

        for(var i:uint=0; i < numColumns; i++)
        {
            column = new DataGridColumn("column"+i.toString());
            column.dataField = "column"+i.toString();
            cols[i]=column;
        }

        this.columns = cols;

        // go to the current
        gotoPage(this._currentPageNum);
    }

    /**
     * Sets the data for the dataprovider based on the 
     * number of columns, rows, and page number.
     * 
     * @param pageNum the page number of the data to be viewed in the DataGrids. 
     */
    private function gotoPage(pageNum:uint):void
    {
        _currentPageNum = pageNum;

        var startIndex:uint = (pageNum-1)*numColumns*numRows;

        var data:ArrayCollection = new ArrayCollection();

        for(var i:uint=0; i < numRows; i++)
        {
            var obj:Object = new Object();

            for(var j:uint=0; j < numColumns; j++)
            {
                if((i+(j*numRows)+startIndex) < _dataProvider.length)
                    obj["column"+j.toString()] = String(_dataProvider.getItemAt(i+(j*numRows)+startIndex)["value"]);
            }

            data.addItem(obj);
        }

        this.dataProvider = data;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:49:22+00:00Added an answer on May 14, 2026 at 3:49 am

    The problem was a timing issue when I was setting the dataProvider at the end. I implemented a callLater function to set the dataProvider and the problem was fixed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wpf datagrid that has it's columns generated dynamically in code and
I have a datagrid view that is bind to a custom collection. I have
I have a DataGrid component that displays a few columns of data. It has
I have a custom <mx:DataGrid /> that is updated with data from a ColdFusion
I have a list of names that I'd like to have bound to a
I have a custom datagrid in my application that when its source is empty
I have custom control that extends DataGrid . It is called ExtendedDataGrid . I
I have DataGrid that connects to REST service. I need to pass some custom
I have a collection of custom data objects that I display in DataGrid. The
I have a custom data structure that is pretty much a list of string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.