It would be even cooler if the arrangement of items and the virtualization of items could be somehow decoupled. For instance, should you really need to implement the same arrangement logic for a non-virtualized set of enyo.Panels and a virtualized enyo.DataList?If things can be kept simple and then transparantly scale up as more complex solutions are needed that would be nice. You don't really need a virtualized asynchronously rendering magic box when you're only displaying a grid of 12 items, after all.
The imperative style is mostly useful when you actually don't have a mutating list of data objects and an indexed lsit of item is really all you care about. Another situation where an imperative api could come in handy is when you want to prefix or suffix a list of items with a control that isn't necessarily bound to a record in your dataset or if you want to pad a grid with placeholder items. In the case of padding you might even want some access to the layout strategy to determine how many items you want to add (for instance, to pad the last row of a fluid grid with placeholders).
By the way, are there any plans to play around with the asynchronous rendering behaviour of the DataRepeater? I remember having some issues working with responsive layouts and grids with asynchronous rendering some time ago. It would be cool if rendering & layout behaviour could be configured to always be synchronous or asynchronous by default and then add an option to force a synchronous render/layout pass when needed.
Finally, about the scrollable mixin, is it intended to eventually replace enyo.Scroller? It would be nice if the scroll state could be observed or if drag events could be forwarded to the scroller from other controls. This would make it easy to write decorators for any scroller to implement any form of additional UI controls. For instance, we've built a decorator for enyo.Scroller to implement a fully functional scrollbar with draggable thumb as well as a scrollable content-area that adds read-more and back-to-top buttons as needed.
Yes, this should be doable. I haven’t worked out the details yet, but I think the API for a layout strategy can be such that you can just ignore the virtualization bits if you don’t need them.
Thanks, this is helpful input. I may ask more specific questions at some point, though it may be a while as the imperative API is not (yet) at the top of the priority list.
Are you referring to the async behavior of DataRepeater.refresh(), or the DataList.renderDelay property and related logic? NewDataList doesn’t carry over the renderDelay stuff, and while it does inherit from DataRepeater (via VirtualDataRepeater) it isn’t using refresh() much, so not sure this async stuff comes into play in common use cases. I would need to poke around a bit and refresh my memory to say for sure. If you happen to have a more specific description or a repro case for the issues you were seeing before, I’d be happy to look at it.
The Scrollable mixin is designed to replace the guts of enyo.Scroller. For convenience and backward compatibility, we will probably still have an enyo.Scroller, but most of its behavior will be provided under the hood by the mixin. The main reason for factoring this way is so that a virtual list (for example) doesn’t need to inherit from a scroller or contain a scroller (which results in extra dom and some unneeded functionality); it can just “act like a scroller” in the relevant ways. Scrollable currently has what I think is a pretty clean, simple API for interfacing with swappable scroll controls, with use cases like yours in mind (though I’m not sure I understand enough about your “scrollable content-area” to say whether it fits the mold of scroll controls that the current API has in mind).