Ask A Question

Notifications

You’re not receiving notifications from this thread.

Use datatables like handsontable

Wouter van den Beld asked in General

Hi,

I would love to see a episode that explains the use of json/ajax and load and save back data back to the server. For example i want to use handsontable (http://handsontable.com/) but i cant load (and save) data to it.

Reply

This looks really cool! I'll definitely make an episode on this stuff in the near future.

In the meantime my recommendation would be to take a look at jbuilder. You can access the same routes as your forms do, but just do that in JS. Then you can and jbuilder responses like "show.json.jbuilder" right next to your show.html.erb file. That'll let you return a JSON object that your Javascript can use.

Same goes for submitting data to the server, you use the same URL as the create and update urls. Make sure the method is either a POST or UPDATE request if you're adding or updating data. The javascript library might expect certain formats for all the JSON you return, so that can help you design how to format your JSON responses for all these actions.

I don't know if that's enough detail to get you pointed in the right direction or not, but I hope that helps a little bit!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.