I hooked up the dataProvider to a ComboBox and the result was more what I expected. The ComboBox seems to make 0 to length-1 calls to getItemAt and then stops. The DataGrid seems to make a fixed number of calls - perhaps a default grid size?
[Debug] cbTest initialized [Debug] TestDP(undefined) [Debug] getItemAt(undefined) [Debug] get length():5 [Debug] get length():5 [Debug] get length():5 [Debug] get length():5 [Debug] get length():5 [Debug] get length():5 [Debug] get length():5 [Debug] get length():5 [Debug] getItemAt(0) [Debug] getItemAt(1) [Debug] getItemAt(2) [Debug] getItemAt(3) [Debug] getItemAt(4) [Debug] get length():5 [Debug] get length():5 [Debug] getItemAt(undefined) --- In [email protected], "Matt Chotin" <[EMAIL PROTECTED]> wrote: > I'd imagine that if you're seeing numerous calls to length interspersed > with getItemAt that we simply didn't do an optimal loop. > > > > for (var idx = 0; idx < dataProvider.length; ++idx) > > { > > var item = getItemAt(idx); > > } > > > > get length() is going to be called on every iteration of the loop. It'd > obviously be more efficient to store length in a local variable and just > use that, but maybe we didn't somewhere. > > > > Matt > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of rbelknap > Sent: Friday, June 03, 2005 3:24 PM > To: [email protected] > Subject: [flexcoders] Contract between DataProvider and ComboBox or > DataGrid > > > > Hi, > > I'm struggling to figure out the implied contract between > DataProviders and their users like ComboBox or DataGrid. When either > a ComboBox or DataGrid first uses a DataProvider they seem to make > numerous calls to: > > public function get length():Number > > and > > function getItemAt(index : Number) > > but it isn't obvious what the logic is behind these calls. > > I was expecting to see a call to get the length followed by a series > of calls to getItemAt starting at index 0 and running to index length- > 1, but that's not what I see. > > Has anyone run across any good discussions of DataProviders and their > users? > > Thanks, > > Randy > > > > > > > ________________________________ > > Yahoo! Groups Links > > * To visit your group on the web, go to: > http://groups.yahoo.com/group/flexcoders/ > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/> . Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

