I am looking for a way to edit data and have values dynamically calculated (i.e. totals, averages, etc.) My application is a web based gradebook system for teachers and one of the big challenges is allowing them to enter/update grades. The most natural solution for this type of data is a table or spreadsheet grid and my first thought was to write something myself, but I quickly got over that idea. :)

The chief problem I'm having is being able to calculate things in real time. When a teacher changes a grade I need the table to update that students AVG % and possibly their letter grade. It doesn't have to feed these calculations back to the server (they are just for show) but the cell changes do have to be saved (via AJAX).

I know this should probably be a FAQ and I found these two answers ([1](https://stackoverflow.com/questions/271276/what-is-the-easiest-way-to-display-an-editable-listlike-a-spreadsheet-in-html), [2](https://stackoverflow.com/questions/158695/spreadsheet-like-functionality-in-webapp)) but my requirements are a bit different (I think). First of all I'm looking for something that integrates with RoR fairly well; this means using Prototype. It should also be pretty lightweight and clean; I don't need fancy things like pictures, sub-groups, etc. Lastly, since my project is under the GPL, it must be open source.

Any hints? Right now I'm looking at [TableKit](http://www.millstream.com.au/view/code/tablekit) & [Rico LiveGrid](http://openrico.org/) but I'm not sure they can do the row & column calculations that I need.