I want to have a page in my Ruby on Rails application that is like a
dynamic
/ updateable data grid. Like a matrix or spreadsheet segment (x rows, y
columns) which one can click in any of the cells and make an update,
which
triggers some AJAX code to fire off the update, and then the responses
come
back and update whatever else needs updating based on this change.
Does Rails support this? Is there a good plugin or sample application
that
does this I can look at? Perhaps a prototype project example?
Also, to see it in practice, take a look at ActiveScaffold: http://www.activescaffold.com/ and try out their demos. They have
basically what you are describing. You could either use their system,
or even look at their source code to see how they did it.
Either way, what you are describing is very doable.
I want to have a page in my Ruby on Rails application that is like a
dynamic / updateable data grid. Like a matrix or spreadsheet
segment (x rows, y columns) which one can click in any of the cells
and make an update, which triggers some AJAX code to fire off the
update, and then the responses come back and update whatever else
needs updating based on this change.
Does Rails support this? Is there a good plugin or sample
application that does this I can look at? Perhaps a prototype
project example?
If it’s a full-featured grid you want, I’d suggest you to look at
ExtJS. You’ll have to use JSON (or XML) to communicate between the
ExtJS components and the Rails (or whatever) backend.
From a brief looks it seems ExtJS is much nicer (finishing looks
excellent) than ActiveScaffold. However should I be concerned that
ExtJS isn’t a Rails plugin? Would ActiveScaffold fit the Rails
approach better in terms of how its AJAX prototype support is built
into the controller/views *.rjs etc? Or is this really not a
concern? (I’m thinking of starting to jump into ExtJS but thought
I’d ask for advise first)
If you’re going to work with extjs, there are a couple of things you
need to be aware of:
extjs is an entity in itself, it’s not part of rails and as such
isn’t tightly coupled into the framework
extjs is a pretty hefty library
extjs is a javascript library, you build your interface through
javascript. no javascript = no extjs
if you want extjs to follow Rails’ restful conventions for updating
a record, you’ll have to manually add the _method=put parameter to the
post parameters, same goes for deleting a record
you’ll have a lot more work than using something like
activescaffold, but extjs does provide more flexibility
you’ll have less work than writing a full javascript component by
yourself (which you could do if you find extjs not up for the job or
just think you can do a better and less hefty job)
check the extjs licensing scheme if you want to use it in a
commercial project
From a brief looks it seems ExtJS is much nicer (finishing looks
excellent)
than ActiveScaffold. However should I be concerned that ExtJS isn’t a
Rails plugin? Would ActiveScaffold fit the Rails approach better in
terms
of how its AJAX prototype support is built into the controller/views
*.rjs
etc? Or is this really not a concern? (I’m thinking of starting to
jump
into ExtJS but thought I’d ask for advise first)