You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you try to display a jqGrid via your plugin for a model that has a an empty array as its value you get the jqGrid error above or you get a JavaScript error in the console complaining about a syntax error:
missing } after property list
[Break on this error] colModel:[{name:'id', index:...ype_id',editoptions:{value:"1:CPU"},widt
If one has a look at the coModel that your plugin returns you see the following syntax error:
The editoptions key for the second column seems to have a single quote for the value key instead of two quotes (as it should have it the array of items was empty). The issue seems to stem from vendor/plugins/2dc_jqgrid/lib/2dc_jqgrid.rb::get_sub_options in the first 'if' conditional block where you check for :value.
Your code does not seem to cater for the fact that couple[1] may contain an empty array:
When you try to display a jqGrid via your plugin for a model that has a an empty array as its value you get the jqGrid error above or you get a JavaScript error in the console complaining about a syntax error:
missing } after property list
[Break on this error] colModel:[{name:'id', index:...ype_id',editoptions:{value:"1:CPU"},widt
If one has a look at the coModel that your plugin returns you see the following syntax error:
--8<--
colModel:[{name:'id', index:'id',resizable:false,width:35},{name:'component_id', index:'component_id',editoptions:{value:"},width:96,editable:true,edittype:'select'},
--8<--
The editoptions key for the second column seems to have a single quote for the value key instead of two quotes (as it should have it the array of items was empty). The issue seems to stem from vendor/plugins/2dc_jqgrid/lib/2dc_jqgrid.rb::get_sub_options in the first 'if' conditional block where you check for :value.
Your code does not seem to cater for the fact that couple[1] may contain an empty array:
325 # Generate options for editable fields (value, data, width, maxvalue, cols, rows, ...)
326 def get_sub_options(editoptions)
327 options = "{"
328 editoptions.each do |couple|
329 if couple[0] == :value # :value => [[1, "Rails"], [2, "Ruby"], [3, "jQuery"]]
330 options << %Q/value:"/
331 couple[1].each do |v|
332 options << "#{v[0]}:#{v[1]};"
333 end
334 options.chop! << %Q/",/
Here is a diff of a possible fix inserted above line #334 (that works for me):
$ diff 2dc_jqgrid.rb 2dc_jqgrid.rb.new
333a334
The text was updated successfully, but these errors were encountered: