Add blank option in search field for multiple search.

This commit is contained in:
邱博亞 2024-08-11 10:19:48 +08:00
parent 7c83a992d2
commit 82080f55a1
1 changed files with 6 additions and 0 deletions

View File

@ -44,6 +44,9 @@ class UniversalTablesController < ApplicationController
if tc.make_categorizable if tc.make_categorizable
select_values = tc.column_entries.distinct("text.#{I18n.locale.to_s}") select_values = tc.column_entries.distinct("text.#{I18n.locale.to_s}")
form_field = "#{csrf_input}<select class=\"form-control\" name=\"q[#{field_key}]\">" form_field = "#{csrf_input}<select class=\"form-control\" name=\"q[#{field_key}]\">"
if field_value.nil?
select_values.insert(0, "")
end
select_values.each do |sv| select_values.each do |sv|
if field_value && sv == field_value if field_value && sv == field_value
selected = " selected" selected = " selected"
@ -58,6 +61,9 @@ class UniversalTablesController < ApplicationController
if tc.make_categorizable if tc.make_categorizable
select_values = tc.column_entries.distinct(:number) select_values = tc.column_entries.distinct(:number)
form_field = "#{csrf_input}<select class=\"form-control\" name=\"q[#{field_key}]\">" form_field = "#{csrf_input}<select class=\"form-control\" name=\"q[#{field_key}]\">"
if field_value.nil?
select_values.insert(0, "")
end
select_values.each do |sv| select_values.each do |sv|
if field_value && sv == field_value if field_value && sv == field_value
selected = " selected" selected = " selected"