Adobe Dreamweaver Forums



Last 10 THreads :         Re: Accurate measurements for printing (Last Post : Don_Gough@adobeforums.com - Replies : 0 - Views : 1 )           »          Re: Paint, erase, burn and dodge won't work for me in CS4 (Last Post : John Joslin - Replies : 0 - Views : 1 )           »          Re: Accurate measurements for printing (Last Post : Don_Gough@adobeforums.com - Replies : 0 - Views : 1 )           »          button rollover to keyframe help (Last Post : mrpetesurfs - Replies : 1 - Views : 2 )           »          Call out side flex (Last Post : G009 - Replies : 13 - Views : 14 )           »          Scaling .swf files to fit specific dimensions (Last Post : wolfsj - Replies : 0 - Views : 1 )           »          Array of Queries (Last Post : ptrott - Replies : 0 - Views : 1 )           »          Can't get Macromedia Authorware Web Player to install onWindows Vista (Last Post : auberj - Replies : 0 - Views : 1 )           »          Form split across two columns (Last Post : RICH POW - Replies : 6 - Views : 7 )           »          NetLobo and Hidden
Tags (Last Post : kiusau - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-03-2008, 04:39 AM
Guddie
 
Posts: n/a
Diggs:
Default "Lock" dataProvider when creating Arrays and DataGridsin loop

I am looping through each item in an Array and for each item, I am trying to
create a new DataGrid on a new Canvas, and then add each Canvas to a ViewStack.

I am experiencing difficulty in setting the dataProvider for the DataGrids. As
part of the loop, I create a new ArrayCollection to serve as the dataProvider
for the last DataGrid created. But since the loop uses just one ArrayCollection
variable, everytime the loop iterates and a new ArrayCollection is created, the
previously created DataGrids' dataProviders point to the new ArrayCollection,
rather than the one that was created during their iteration. For example, I can
end up with 10 DataGrids (on 10 Canvases) in the ViewStack, and all of their
dataProviders will point to last ArrayCollection created, rather than the
ArrayCollection created in the same iteration of the loop that created that
respective DataGrid.

Is there a way to take a static "snapshot" (for lack of better terms) of an
ArrayCollection in each iteration and use that as the dataProvider for the
newly created DataGrid in that same iteration? Any help or insight is much
appreciated.

//Loop through results, add info to DataGrids and DataGrids to ViewStack
var canvas:Canvas;
var dgataGrid;
var dgArray:ArrayCollection;
var dgCols:Array;
var dgFieldColataGridColumn;
var dgValColataGridColumn;
for each (var result:IdentifyResult in event.identifyResults)
{

dg = new DataGrid;
dg.percentHeight = 100;
dg.percentWidth = 100;
dgCols = dg.columns;
dgFieldCol = new DataGridColumn;
dgValCol = new DataGridColumn;

dg.showHeaders = false;
dg.percentHeight = 100;
dg.percentWidth = 100;
//dg.addEventListener(ListEvent.ITEM_CLICK,onCellP ress);
dgFieldCol.dataField = "field";
dgFieldCol.width = 30;
dgValCol.dataField = "val";
dgValCol.width = 70;

dgCols.push(dgFieldCol);
dgCols.push(dgValCol);
dg.columns = dgCols;

dgArray = new ArrayCollection;
for (var detail:String in result.feature.attributes)
{
dgArray.addItem({field:detail,
val:searchReplace(result.feature.attributes[detail],"Null","")});
}

//set up dgArray for datagrid
dg.dataProvider = dgArray;

//Canvas
canvas = new Canvas;
canvas.percentHeight = 100;
canvas.percentWidth = 100;
canvas.addChild(dg);

//Add DataGrid canvas to ViewStack
idViewStack.addChild(canvas);
}



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-03-2008, 04:39 AM
Guddie
 
Posts: n/a
Diggs:
Default Re: "Lock" dataProvider when creating Arrays andDataGrids in loop

I think I fixed it. Moving var dgArray:ArrayCollection; above dgArray = new ArrayCollection; seems to have done the trick, and makes sense logically.
Reply With Quote
  #3 (permalink)  
Old 11-03-2008, 04:39 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: "Lock" dataProvider when creating Arrays and DataGrids in loop


"Guddie" <webforumsuser@macromedia.com> wrote in message
news:gefgau$8ep$1@forums.macromedia.com...
>I think I fixed it. Moving var dgArray:ArrayCollection; above dgArray = new
>ArrayCollection; seems to have done the trick, and makes sense logically.


Might I suggest that you look at my GroupingFunction calendar example to see
one way that you can have a control (in my case a TileList) that _appears_
like there are a lot of them being switched between with a TabBar, but
what's actually happening is the dataProvider is simply being filtered in a
different way:

http://flexdiary.blogspot.com/2008/0...featuring.html


Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 09:36 PM.


Right Column Title

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk