AJAX based data grid for Rails App? Is there any code/approach I can leverage?

Hi,

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?

Thanks in advance
Greg

Greg,

Id start by looking at Rails’ in_place_editor:
http://api.rubyonrails.com/classes/ActionView/Helpers/JavaScriptMacrosHelper.html#M000575
or this blog:
http://rubythis.blogspot.com/2006/11/using-rails-inplaceeditor-and.html

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.

-Danimal

On Apr 3, 8:46 pm, “Greg H.” [email protected]

On 04 Apr 2008, at 04:46, Greg H. wrote:

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.

Although it doesn’t provide an editable grid, the Ext Scaffold
Generator plugin does have some nifty features you can base your code
on:
http://inside.glnetworks.de/2008/01/18/announcing-ext-scaffold-generator-plugin-for-rails/

Best regards

Peter De Berdt

On 04 Apr 2008, at 11:21, Greg H. wrote:

Excellent - thanks guys.

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

Best regards

Peter De Berdt

Excellent - thanks guys.

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)

On Fri, Apr 4, 2008 at 5:46 PM, Peter De Berdt
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs