PDA

View Full Version : Building grids from existing markup



sidthegeek
29 Dec 2007, 9:46 AM
Hello,

I'm thinking about how to create a "progressive-enhancement" grid that can add the fancy Ext grid features to an existing grid. (Apologies if this issue has been discussed earlier -- I would appreciate pointers to such discussions. I did look in the forums but did not find too much.)

If I understand correctly, the approach taken by the 'grid-from-existing-markup' example (http://extjs.com/deploy/ext-1.1.1/examples/grid/from-markup.html) is to traverse the DOM for the existing table markup, recreate the entire table with Ext markup, and then optionally discard the existing one. This seems like an expensive approach, particularly when the grids are larger (several hundred rows): We would need to do the conversion on page load, and take the conversion hit even if the user did not ever use the sorting, for example.

So I'm wondering if we can get the server side to co-operate. Specifically, can we prescribe a specific template format for the grid, as delivered by the server, which can be consumed by client-side code? Such client-side code would merely set up the grid's client-side internal data structures, rather than re-creating the markup from scratch. This would give us several benefits:


The template grid would look pretty, just like the Ext grid.
It would load fast, because we don't take the hit for re-creating markup.
Since it's built from existing markup, it would be usable in non-JavaScript browsers such as minimally-equipped cell phones.
It would be a "pay-as-you-go" scheme: If the user actually uses one of the Ext features, there would be the cost of client-side computation incurred, otherwise not.


What do you guys think? Has this already been done? If so, I'd love to see some pointers to it.

Thanks in advance.