I currently have a timesheet page which displays a calendar, a search
function that allows a user to search for a project. Once the user has
selected a specified project they press the plus button that creates a
new row in a new table. I’ve done this using Javascript. I am so close
to finishing this functionality.Forgive me if this sounds stupid, as I
am new to rails. I was wondering is it possible to parse in a rails
object into Javascript, so that when the plus button is selected it then
creates a new row with the data.
Example of some of my code:
<% @projects.each do |project| %>
<td><%= link_to_function image_tag("icons/add.png"),
“CreateNewRow()” %>
</tr>
This simply creates a new a table, and list all the projects in my
projects table. A plus icon is linked to CreateNewRow() Javascript
function. I currently have the createNewRow() function working. However
I can’t seem to get it to take the data and put it into new created row.
Supplied an image to make it a little bit more clearer.