Rails How to render dynamic javascript -


I am trying to use gridify grid control:

JavaScript code on my watch page Any idea is getting? I wrote & lt;% = @ grid% & gt; On my index.html.rb, it seems that the rail escapes the JavaScript tag, I see this code on the watch page instead of the actual code:

  & lt; Script type = "text / javascript" & gt; Function gridify_fluid_recalc_width () {if (grids = jQuery ('fluid.ui-jqgrid-btable: visible')) {grids.each (function (index) {gridId = jQuery (this) .attr ('id'); gridParentWidth = JQuery ('# gbox_' + gridId) .Parent (). Width (); jQuery ('#' + gridId) .setGridWidth (gridParentWidth);}); }}; JQuery (window) .bund ('resize', gridify_fluid_recalc_width); Function gridify_action_error_handler (r, data, action) {if (r.responseText! = '') {Return [wrong, r.responseText]; } And {return true; JquGrid ({"first select": function () {false;}, "resizeStop": gridify_fluid_recalc_width, "autowidth": true, "ROWNUM": - 1, "gridview": true, "comfortable": true , "Url": "/ contact", "hidegrid": false, "XmlReader": {"Total": "Contact & gt; TOTAL_PAGES" "row": "contact", "id": "id", "root True, "datatype": "xml": "contact", "page": "contact", "record": "contact"; total_records "," repeatitems ": false}," forceFit " "," "," "{@}": "" "" "" "", "" "" "" "", "Post", "POSTDATA": {"grid"}, "colModel": [{"label": "id", "name": "id", "sorttype": "integer", "align" "Right", "index": "id", "hidden": true}, {"label": "title", " "": "Title", "sorttype": "text", "index": "title"}, {"label": "address", "name": "address", "sorttype": "text", " "Phone1", "name1", "phone1", "sorttype": "text", "index": "phone1"}, {"label": "phone2" , "Name": "phone2", "sorttype": "text", "index": "phone2"}, {"label": "fax", "name": "fax" "sorttype": "text" "Register": "register", "index": "label": "registration number", "name": "registration_number", "sort", ":" text "," index ":" register_number "}, {" Label ":" identity number "," name ":" identity_number "," sorttype ":" text "," index ":" identity_number "}," name ":" national "Name": "name": "father", "name type": "text", "index type": "national code"}, {"label": "father name", "name": "father_name", "sorttype "Birthday", "name": "birthday", "sorttype": null, "index": "birthday", "name": "birthday", "name" "Contact type", "name": "contact_type_id", "sorttype": "integer", "align": "right", "index": "contact_type_id"}, {"formatoptions": "date", " Type type ":" date ":" date "," new format ":" fulldetime "}," label ":" created "," name ":" created "," forf "", "Name": "updated_at"}, "created_at"}, {"formatoptions": {"srcformat": "universal assorted datetime", "newform": "fuldiet"), "label", "formatter": "Date_", "sorttype": "datety", "index": "updated_at"}, {"label": "city", "name": "city_id", "sorttype": "integer", "align" : "Correct", "index": "city_ide"}], "havaro": incorrect}). Ad class ("flu id") .jqGrid ('grid resize', {"minhite": 80, "handle" "S", "minWidth": 150}); Grid [0] .toggleToolbar (); }); & Lt; / Script & gt;    

I got the answer, let me & lt;% = raw Need to use @ grid% & gt; But I do not know why this is not on the document of gridify.

Comments