Hi Tom,

Regarding the _items property of the RO result, I think that would
depend on what the results from your remote object look like.  The
property name does look like an internal Flex varaible, though; did
you originally get that from a code sample?

I typically just set my data variable to the result property of the
event (I like to pass the full event object) after running it
through mx.utils.ArrayUtil.toArray() to make sure I've got an array
and not a simple object:

  import mx.utils.ArrayUtil;

  function handleROResults(event: Object) : Void {
      myData = ArrayUtil.toArray(event.result);
  }


--- In flexcoders@yahoogroups.com, Tom Sammons <[EMAIL PROTECTED]> wrote:
>
> I was looking all over the place for an array append type of 
method,
> but did you think I'd put in "concatenate"? Noooooo. And I was
staring
> right at the Flex AS array doc. Doh.  Well, I wouldn't have
thought of
> or known to just add [{}] to it anyway...
>
> I don't think I'll have any problem with the state management,
although
> I do see that the ROs for the repeater grid data does get bundled
> together the way I have it now.  I'll just pass the index along
with the
> calls and use the result handler to capture that on return.
>
> Was I correct about referencing _items (var
thisROResultItemsArray:Array
> = RO2.result._items; repeaterData[i].dp = thisROResultItemsArray;)
or
> would just .result be sufficient?  (I guess I check that on my
own; it's
> bring your kids to work day here and it's a little...disruptive to
my
> concentration |:-)
>
> I thought about passing everything back with the original repeater
dp
> data call, but to be perfectly honest, I was really hoping that it
> wouldn't come to that.  I have a couple of project deadlines
coming up
> that are largely dull in terms of creativity requirements, and
I've been
> putting off those a little bit to have some fun with this.
>
> Thanks once more, Doug, and have a great day!
>
> Tom
>
>
> Doug Lowder wrote:
>
> >Hi Tom,
> >
> >If your repeated data is dynamic, you can reset your repeater by
> >just updating the repeaterData variable.  To see what I mean,
change
> >the repeaterData declaration to "repeaterData: Array = []" and
add
> >the following button to the control bar in the code I posted.
> >
> ><mx:Button label="Add a new grid"
> >  click="repeaterData = repeaterData.concat([{}]);"/>
> >
> >This is the beauty of data binding - just update your bound
variable
> >and you're good to go.  To update any other bound variable, even
> >something like repeaterData[i].dp, the process is the same.  The
> >syntax for your RO result example would be:
> >
> >repeaterData[i].dp = thisROResultItemsArray;
> >
> >You'll have to do some state management to know what the value
> >of "i" should be for results returned from any particular RO
method
> >call, or you could reorganize your RO methods to return all the
data
> >at once (the repeated data, i.e. the number of datagrids, as well
as
> >the contents of each grid to use as the grid's dataprovider). 
Also,
> >be aware that RemoteObject calls return data asynchronously;
you'll
> >usually need to specify a result handler function for each
method,
> >which will get called once results are returned from a method
call
> >in another function.
> >
> >Something to watch out for is the difference between the Array
class
> >and the DataProvider class.  You can use Arrays as DataProvders,
but
> >not all Array methods will cause binding events to fire.  Check
out
> >the DataProvider class in the docs.
> >
> >
> >--- In flexcoders@yahoogroups.com, Tom Sammons <tsammons@> wrote:
> > 
> >
> >>Thanks for the quick reply Doug, that is great and all makes
sense
> >>   
> >>
> >and I
> > 
> >
> >>can see what's going on.  I can make it work with a little
> >>   
> >>
> >manipulation
> > 
> >
> >>of the inner RO calls by using for loops.  And had I thought
about
> >>   
> >>
> >it
> > 
> >
> >>more, you are right that event.dragSource et al would have all
the
> >>information I needed, so that part really should be simple
enough
> >>   
> >>
> >to
> > 
> >
> >>implement.
> >>
> >>But could you explain how I would initialize the repeaterData
> >>   
> >>
> >array if
> > 
> >
> >>the number of elements is dynamic, i.e., returned from a query
> >>   
> >>
> >such as
> > 
> >
> >>what I am trying to do?  That would be this line:
> >>
> >>var repeaterData: Array = [ {}, {}, {} ];
> >>
> >>to set the Array elements from RO.results without hardcoding the
> >>   
> >>
> >size of
> > 
> >
> >>the array.
> >>
> >>And actually/ideally, I would want to make this a component at
> >>   
> >>
> >some
> > 
> >
> >>point, so how would I make this line of AS:
> >>
> >>repeaterData[i].dp = [{Number: n++}, {Number: n++}, {Number:
n++}];
> >>
> >>populate itself from a second RO query recordset where I
wouldn't
> >>necessarily know what the column names are?  Something like:
> >>
> >>var thisROResultItemsArray:Array = RO2.result._items;  //since
> >>   
> >>
> >_items is
> > 
> >
> >>already an array
> >>repeaterData[i].dp = [{thisROResultItemsArray}];
> >>
> >>Excuse me if I'm being dense or am missing something completely
> >>obvious.  I'm betting that F2 is a lot easier with this, but it
> >>   
> >>
> >will
> > 
> >
> >>really help to get this into my noggin now.
> >>
> >>Thanks again!
> >>Tom
> >>
> >>Doug Lowder wrote:
> >>
> >>   
> >>
> >>>Hi Tom,
> >>>
> >>>Hopefully the sample code below will be enough to get you
> >>>     
> >>>
> >started. 
> > 
> >
> >>>Once the repeated grids have had their dataproviders bound to
an
> >>>array, all you need to do is reassign another array to update
> >>>     
> >>>
> >the grid
> > 
> >
> >>>just as the "Update grids" button in the sample does.  The
> >>>     
> >>>
> >sample
> > 
> >
> >>>accomplishes this reassignment with the Array.slice() method. 
> >>>     
> >>>
> >You
> > 
> >
> >>>could also use the various grid and dataprovider methods
(addItem
> >>>     
> >>>
> >(),
> > 
> >
> >>>replaceItem(), editField(), etc) to make changes on a row-by-
row
> >>>basis.  You should be able to use a remote object result
handler
> >>>     
> >>>
> >in
> > 
> >
> >>>place of the button's click handler to update the dataprovider
> >>>     
> >>>
> >arrays.
> > 
> >
> >>>I'll leave the drag-and-drop portion to you, but essentially I
> >>>     
> >>>
> >believe
> > 
> >
> >>>everything you require should be in the event parameter:
> >>>     
> >>>
> >event.target,
> > 
> >
> >>>event.dragSource, etc.
> >>>
> >>><?xml version="1.0"?>
> >>><mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
> >>>width="100%">
> >>>
> >>>    <mx:Script>
> >>>    <![CDATA[
> >>>
> >>>    var repeaterData: Array = [ {}, {}, {} ];
> >>>
> >>>    function updateData() : Void {
> >>>        var n: Number = 0;
> >>>        for (var i = 0; i < repeaterData.length; i++) {
> >>>            var dp: Array = repeaterData[i].dp;
> >>>            if (dp == undefined) {
> >>>                repeaterData[i].dp = [{Number: n++}, {Number:
> >>>     
> >>>
> >n++},
> > 
> >
> >>>{Number: n++}];
> >>>            }
> >>>            else {
> >>>                for (var j = 0; j < dp.length; j++) {
> >>>                    dp[j].Number++;
> >>>                }
> >>>                repeaterData[i].dp = dp.slice();
> >>>            }
> >>>        }
> >>>    }
> >>>
> >>>    ]]>
> >>>    </mx:Script>
> >>>
> >>>    <mx:Panel title="Repeated Data Grids" width="80%">
> >>>
> >>>        <mx:HBox width="100%">
> >>>      
> >>>            <mx:Repeater id="rp" dataProvider="{repeaterData}">
> >>>                <mx:DataGrid dataProvider="{rp.currentItem.dp}"
> >>>width="100%"/>
> >>>            </mx:Repeater>
> >>>
> >>>        </mx:HBox>
> >>>
> >>>        <mx:ControlBar>
> >>>            <mx:Button label="Update grids" click="updateData
> >>>     
> >>>
> >()"/>
> > 
> >
> >>>        </mx:ControlBar>
> >>>
> >>>    </mx:Panel>
> >>>
> >>></mx:Application>
> >>>
> >>>
> >>>--- In flexcoders@yahoogroups.com, Tom Sammons <tsammons@>
wrote:
> >>>     
> >>>
> >>>>Hi all,
> >>>>
> >>>>Long time viewer, first time caller... [never mind, it's a
> >>>>       
> >>>>
> >>>pittsburgh thing]
> >>>     
> >>>
> >>>>What I'm trying to accomplish is to populate a regular
> >>>>       
> >>>>
> >datagrid with
> > 
> >
> >>>>records representing unassigned requests, and then use a
> >>>>       
> >>>>
> >repeater to
> > 
> >
> >>>>display grids of current workload requests for a short list of
> >>>>personnel. An administrator would drag and drop unassigned
> >>>>       
> >>>>
> >requests
> > 
> >
> >>>>into the workload grids, and be able to drag/drop between
> >>>>       
> >>>>
> >workload
> > 
> >
> >>>grids
> >>>     
> >>>
> >>>>as well for the purpose of balancing/spreading personnel work
> >>>>       
> >>>>
> >around.
> > 
> >
> >>>>(Eventually, I want to be able to use shared objects to
> >>>>       
> >>>>
> >automatically
> > 
> >
> >>>>update at the client level as well to improve the
> >>>>       
> >>>>
> >collaboration, but
> > 
> >
> >>>>that's a different effort.)
> >>>>
> >>>>I've been unable to find a suitable example or solution that
> >>>>       
> >>>>
> >would
> > 
> >
> >>>>demonstrate how one would set the dataProvider for datagrids
> >>>>       
> >>>>
> >generated
> > 
> >
> >>>>by a Repeater. Obviously, if I bind the provider during
> >>>>       
> >>>>
> >Repeater
> > 
> >
> >>>>execution it will populate all the grids with the last remote
> >>>>       
> >>>>
> >object
> > 
> >
> >>>>call. (I'm not at all interested in using XML, although even
> >>>>       
> >>>>
> >that would
> > 
> >
> >>>>give me a lead.) From a performance aspect, I'm not positive
> >>>>       
> >>>>
> >that the
> > 
> >
> >>>>repeater may not be the best way to go -- although Tracy posted
> >>>>something that says otherwise in 18378 -- but the workload
> >>>>       
> >>>>
> >grids will
> > 
> >
> >>>>generally only be between 3 and 6 in count, and the repeater
> >>>>       
> >>>>
> >seems to
> > 
> >
> >>>>handle that quite well from what I've seen so far, plus takes
> >>>>       
> >>>>
> >care of
> > 
> >
> >>>>all the nice formatting. Just so you know, F2 isn't an option
> >>>>       
> >>>>
> >right now.
> > 
> >
> >>>>I'd really appreciate it if someone could provide an example
> >>>>       
> >>>>
> >of how I
> > 
> >
> >>>>can populate the repeater grids with different remote object
> >>>>       
> >>>>
> >calls, and
> > 
> >
> >>>>how I would use the event.target.getRepeaterItem during the
> >>>>       
> >>>>
> >drag
> > 
> >
> >>>>function (since I'm not sure how to use that to refe! rence a
> >>>>       
> >>>>
> >specific
> > 
> >
> >>>>datagrid id in the repeater array --- did I say that right?).
> >>>>       
> >>>>
> >I think
> > 
> >
> >>>>once I have the former, I could figure out how to get all the
> >>>>       
> >>>>
> >other
> > 
> >
> >>>>information I need. I already know how to pass entire datagrid
> >>>>structures to ROs for updates, so I just need a friendly
> >>>>       
> >>>>
> >jumpstart to
> > 
> >
> >>>>get my head around this Repeater stuff.
> >>>>
> >>>>Any help or pointers would be greatly appreciated, and I'll
> >>>>       
> >>>>
> >post the
> > 
> >
> >>>>working code for others who might be interested as well.
> >>>>
> >>>>Tom
> >>>>
> >>>>       
> >>>>
> >>>
> >>>--
> >>>Flexcoders Mailing List
> >>>FAQ:
> >>>     
> >>>
> >http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > 
> >
> >>>Search Archives: http://www.mail-archive.com/flexcoders%
> >>>     
> >>>
> >40yahoogroups.com
> > 
> >
> >>>
> >>>SPONSORED LINKS
> >>>Web site design development
> >>><http://groups.yahoo.com/gads?
> >>>     
> >>>
>
>t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2
=
>
>Computer+software+development&w3=Software+design+and+development&w4=
M
>
>acromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=
L
> >-4QTvxB_quFDtMyhrQaHQ>
> > 
> >
> >>>      Computer software development
> >>><http://groups.yahoo.com/gads?
> >>>     
> >>>
>
>t=ms&k=Computer+software+development&w1=Web+site+design+development&
w
>
>2=Computer+software+development&w3=Software+design+and+development&w
4
>
>=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.si
g
> >=lvQjSRfQDfWudJSe1lLjHw>
> > 
> >
> >>>      Software design and development
> >>><http://groups.yahoo.com/gads?
> >>>     
> >>>
>
>t=ms&k=Software+design+and+development&w1=Web+site+design+developmen
t
>
>&w2=Computer+software+development&w3=Software+design+and+development
&
>
>w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.
s
> >ig=1pMBCdo3DsJbuU9AEmO1oQ>
> > 
> >
> >>>Macromedia flex
> >>><http://groups.yahoo.com/gads?
> >>>     
> >>>
>
>t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+so
f
>
>tware+development&w3=Software+design+and+development&w4=Macromedia+f
l
>
>ex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_Ep
Z
> >I36cYzBjw>
> > 
> >
> >>>      Software development best practice
> >>><http://groups.yahoo.com/gads?
> >>>     
> >>>
>
>t=ms&k=Software+development+best+practice&w1=Web+site+design+develop
m
>
>ent&w2=Computer+software+development&w3=Software+design+and+developm
e
>
>nt&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=16
6
> >&.sig=f89quyyulIDsnABLD6IXIw>
> > 
> >
> >>>
> >>>----------------------------------------------------------------
-
> >>>     
> >>>
> >-------
> > 
> >
> >>>YAHOO! GROUPS LINKS
> >>>
> >>>    *  Visit your group "flexcoders
> >>>      <http://groups.yahoo.com/group/flexcoders>" on the web.
> >>>      
> >>>    *  To unsubscribe from this group, send an email to:
> >>>       [EMAIL PROTECTED]
> >>>      <mailto:[EMAIL PROTECTED]
> >>>     
> >>>
> >subject=Unsubscribe>
> > 
> >
> >>>      
> >>>    *  Your use of Yahoo! Groups is subject to the Yahoo! Terms
> >>>     
> >>>
> >of
> > 
> >
> >>>      Service <http://docs.yahoo.com/info/terms/>.
> >>>
> >>>
> >>>----------------------------------------------------------------
-
> >>>     
> >>>
> >-------
> > 
> >
> >
> >
> >
> >
> >
> >
> >--
> >Flexcoders Mailing List
> >FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> >Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
> >Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> > 
> >
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to