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

**URL:** <https://www.ruby-forum.com/t/ajax-based-data-grid-for-rails-app-is-there-any-code-approach-i-can-leverage/133832>\
**Category:** Rails\
**Created:** [April 4, 2008, 4:47am UTC](https://www.ruby-forum.com/t/ajax-based-data-grid-for-rails-app-is-there-any-code-approach-i-can-leverage/133832 "2008-04-04T04:47:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [April 4, 2008, 4:47am UTC](https://www.ruby-forum.com/t/ajax-based-data-grid-for-rails-app-is-there-any-code-approach-i-can-leverage/133832/1 "2008-04-04T04:47:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [April 4, 2008, 6:53am UTC](https://www.ruby-forum.com/t/ajax-based-data-grid-for-rails-app-is-there-any-code-approach-i-can-leverage/133832/2 "2008-04-04T06:53:36Z")

</div>

Greg,

Id start by looking at Rails’ in\_place\_editor:  
[http://api.rubyonrails.com/classes/ActionView/Helpers/JavaScriptMacrosHelper.html#M000575](http://api.rubyonrails.com/classes/ActionView/Helpers/JavaScriptMacrosHelper.html#M000575)  
or this blog:  
[http://rubythis.blogspot.com/2006/11/using-rails-inplaceeditor-and.html](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/](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.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [April 4, 2008, 9:47am UTC](https://www.ruby-forum.com/t/ajax-based-data-grid-for-rails-app-is-there-any-code-approach-i-can-leverage/133832/3 "2008-04-04T09:47:19Z")

</div>

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/](http://inside.glnetworks.de/2008/01/18/announcing-ext-scaffold-generator-plugin-for-rails/)

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [April 4, 2008, 11:42am UTC](https://www.ruby-forum.com/t/ajax-based-data-grid-for-rails-app-is-there-any-code-approach-i-can-leverage/133832/4 "2008-04-04T11:42:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [April 4, 2008, 11:22am UTC](https://www.ruby-forum.com/t/ajax-based-data-grid-for-rails-app-is-there-any-code-approach-i-can-leverage/133832/5 "2008-04-04T11:22:27Z")

</div>

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  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
