--
You received this message because you are subscribed to the Google Groups "BulkLoader users" group.
To post to this group, send email to bulkload...@googlegroups.com.
To unsubscribe from this group, send email to bulkloader-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bulkloader-users?hl=en.
> - the complete handler for all items gets called twice,
> once for the items that are loaded correctly the first time
> and once for when they are loaded including the alternative image.
If this is happening its a bug. Period. If so, it usually is good
practice to remove listeners inside it's handlers (to avoid either
memory leaks or multiple dispatches). If you can provide a minimal
test case showing that, I'd appreciate it.
> About the second issue: Is there a way to sort the array
> on item id's, for instance by using the Array.sort or Array.sortOn
> method,
> and how would that look?
Items are just a regular array. You can sort it any way you like:
sortOn, a regular loop and custom logic. You name it.
The thing is, this one example of BulkLoaders permissive design.
It's usually not a good thing to allow users to mock directly with the
'items' collection. They might remove stuff that should be there, add
odd things, etc. The way I've deal with it is this:
- bulkLoader.items -> Returns a **copy** of the all items in that
bulkloader. For most users. It's safer.
- bulkLoader._items -> Returns the original thing. Just don't do weird
stuff with it. Nothing is private in BulkLoader. If you know what you
are doing, go ahead.
If you go through the code, there are updates to properties every time
an item is added or removed (look inside the implementation of 'add'
and 'remove' for an idea of what it looks like). This means that
adding or removing items should be done through those methods. Direct
manipulation will get you weird behavior.
The way to deal with is correct, with the caveat that 2 onCompletes
would definitely a bug.
Two ideas to explore as well:
- On the item fail: change it to the new URL. And ask to reload it .
(beware: kludge)
- If removing and adding it, you can always use the priority property
or 'loadNow' to assure loading as quickly as possible.
Best Regards
--
Arthur Debert
www.stimuli.com.br