[dojo-contributors] My attempt at a lightweight mobile-ready grid/table

Kris Zyp kzyp at dojotoolkit.org
Thu Oct 7 13:05:25 EDT 2010

On 10/7/2010 4:42 AM, Evan Huang wrote:
> Great works, Kris,
> The synch store api brings significant simplifications and the new
> observer/stateful patten looks very impressive.
> BTW, something may worth a discussion so that we can ideally have the
> same new Grid core scaled well both for desktop and mobile:
> 1. Have a centralized class for registering & dispatching events?
> This would be more convenient for event customization, typically e.g.
> to easily plug in the further touch & gesture event layer
One of the ideas I was exploring with this design was mostly
sidestepping the event handling, and by providing a persistent DOM
structure (that don't just disappear with innerHTML renderings), making
it easy and sane for developers to connect directly to the DOM events.
The current DataGrid has a fair amount of code for event handling, and I
wanted to see if I could avoid this. Perhaps this isn't ideal, or maybe
some event handling help would be appropriate, I don't know. The one
event handling area I did think would be helpful is to delegate events
to column event handlers so that a fast hash-based delegation mechanism
could be used.
> 2. Virtual paging model
> It's great that the adjacent divs are also used as page holders, so
> for huge pages(data), I suppose the "padding position"  way will be
> used, right?
> 3. Have a separate scroller managing the virtual paging
> So that it will be easier to add a pagination plugin or we can even
> make the pagination as default?
Yes, I do think that my prototype could be broken down out into a the
row-list rendering, and the virtual paging scroller handling component
(so it could alternately be used with a manual paginator), and that
would be a good improvement.
> 4. UI rendering customization - especially when adding UI plugins
> Ideally Grid core won't have concept of any plugins but only with
> interfaces opened, so that various plugins can hook in and add
> corresponding UI parts
> 5. Advanced features & backward compatibility
> This won't be a problem for mobile, but the desktop version is
> supposed to keep supporting some complex layout e.g. multiple views,
> flexible colSpan/rowSpan etc. 
This definitely takes a good portion of the code size and complexity of
the DataGrid. Ideally I like to be able to keep this out of the core,
and have a multi-view and/or spanning add-ons.

> Another big pain is backward
> compatibility, can I assume that after moving to new sotre() API, we
> can still make it compatible with previous data api with adapters?
dojo.store.DataStore is the adapter for using existing dojo data stores
with new object store consumers (like this component).

> Sorry for coming up with these stuff, I know they may break the
> simplification, but it's just a trade off.

Also, FWIW, it wasn't my intention to dismiss any other efforts on the
grid with this prototype. I developed this because we needed something
to test the new store API before it goes live in 1.6, and I wanted to
explore some ideas and how we could make something like for mobile. At
this point, I wouldn't want to necessarily discourage other design
possibilities and parallel efforts with a next generation table. Just
want to be stepping on toes with this little prototype. I don't want to
be the table/grid maintainer/lead or anything like that.


More information about the dojo-contributors mailing list