I am new to AJAX and jQuery, so please excuse me if this is pretty simple:
I implemented a big jgrid on 2dconcepts ( http://www.2dconcept.com/jquery-grid-rails-plugin ). Now I would like to select the data in my table using the checkbox - get the product identifiers (which works fine, I see a warning from "handleSelection") and pass it to my user action in the rails controller to edit the specified record (very similar to Ryan B railscast # 165). I just donβt know how I will do it.
<script type="text/javascript"> function handleSelection(id) { alert('Open those up?:'+id); } </script> <% title "JGRID Table" %> <%= jqgrid("Products", "products", "/products", [ { :field => "id", :label => "ID", :width => 40, :resizable => false }, { :field => "vendorname", :width => 200, :label => "vendorname", :editable => true }, { :field => "productname", :width => 230, :label => "productname", :editable => true }, { :field => "metakeyword", :width => 250, :label => "metakeyword", :editable => true }, { :field => "status", :width => 100, :label => "status", :editable => true, :edittype => "select", :editoptions => { :value => [["inbox","inbox"], ["todo", "todo"], ["final","final"]] } }, { :field => "category_id", :label => "category_id", :width => 100, :resizable => false, :editable => true } ], { :add => true, :edit => true, :inline_edit => true, :delete => true, :edit_url => "/products/post_data", :rows_per_page => 30, :height => 270, :selection_handler => "handleSelection", :multi_selection => true } )%>
I think I need to put a post request into a function and call it something like this:
<%= button_to_function('EDIT CHECKED', 'handleSelection(id)', { :id => "products_select_button"}) %>
But honestly, even this button will not work, because it passes the string "products_select_button" to the function, not the collected value ...
Your help is much appreciated!
Shaft
"products_select_button"})%>