diff --git a/assets/javascripts/reporting/controls.js b/assets/javascripts/reporting/controls.js index 05387633ee..f69c31ca7d 100644 --- a/assets/javascripts/reporting/controls.js +++ b/assets/javascripts/reporting/controls.js @@ -80,14 +80,17 @@ Reporting.Controls = { }, serialize_settings_form: function() { - var ret_str = Form.serialize('query_form'); - var rows = Sortable.serialize('group_by_rows'); - var columns = Sortable.serialize('group_by_columns'); - if (rows !== null && rows != "") { - ret_str += "&" + rows; - } - if(columns !== null && columns != "") { - ret_str += "&" + columns; + var ret_str, grouping_str; + ret_str = Form.serialize('query_form'); + grouping_str = $w('rows columns').inject('', function(grouping, type) { + return grouping + $('group_by_' + type).select('.group_by_element').map(function(group_by) { + return 'groups[' + type + '][]=' + group_by.readAttribute('data-group-by'); + }).inject('', function(all_group_str, group_str) { + return all_group_str + '&' + group_str; + }); + }); + if (grouping_str.length > 0) { + ret_str += grouping_str; } return ret_str; }, diff --git a/assets/javascripts/reporting/group_bys.js b/assets/javascripts/reporting/group_bys.js index 9d496394e5..9f0773eb22 100644 --- a/assets/javascripts/reporting/group_bys.js +++ b/assets/javascripts/reporting/group_bys.js @@ -10,7 +10,6 @@ Reporting.GroupBys = { constraint:'horizontal', containment: ['group_by_columns','group_by_rows'], dropOnEmpty: true, - format: /^(.*)$/, hoverclass: 'drag_container_accept', onUpdate: Reporting.GroupBys.ordering_changed }; diff --git a/lib/widget/group_bys.rb b/lib/widget/group_bys.rb index d6c5f9fa25..4d185e1c9d 100644 --- a/lib/widget/group_bys.rb +++ b/lib/widget/group_bys.rb @@ -5,7 +5,7 @@ class Widget::GroupBys < Widget::Base content_tag :div, :id => "group_by_#{type}", :class => 'drag_target drag_container' do out = '' #TODO render existing group_bys of type - out += content_tag :select, :id => "add_group_by_#{type}", :name => "groups[#{type}][]", :class => 'select-small' do + out += content_tag :select, :id => "add_group_by_#{type}", :class => 'select-small' do options = tag :option, :value => '' engine::GroupBy.all.each do |group_by_class| options += content_tag :option, :value => group_by_class.underscore_name, :'data-label' => "#{l(group_by_class.label)}" do