Skip to content

Latest commit

 

History

History
198 lines (142 loc) · 5.55 KB

File metadata and controls

198 lines (142 loc) · 5.55 KB

Changelog

[2.0.10]

  • Fix dynamic filter error #349.

[2.0.9]

  • Use new Rails 7.1 locals notation in ERB partials.
  • The FormBuilder#datagrid_filter_input method now accepts select_choices and select_options options for the select tag.
  • Rename the Datagrid#select_options method to #select_choices.
  • Added a partial for the dynamic filter allowing to customize the UI #347.
<%# locals: (filter:, form:, field_options:, operation_options:, value_options:) -%>

<%= form.datagrid_filter_input(
      filter,
      **field_options,
      class: [*field_options[:class], "datagrid-dynamic-field"]
    ) %>

<%= form.datagrid_filter_input(
      filter,
      **operation_options,
      class: [*operation_options[:class], "datagrid-dynamic-operation"]
    ) %>

<%= form.datagrid_filter_input(
      filter,
      **value_options,
      class: [*value_options[:class], "datagrid-dynamic-value"]
    ) %>

[2.0.8]

  • Rescue StatementInvalid when guessing column type from a query
  • Prevent typecasting of date into timestamp when :date filter has a block
class MyGrid < Datagrid::Base
  scope { User }

  filter(:created_at, :date) do |scope, value|
    value.is_a?(Date) # => true
    scope.joins(:registration).where(registrations: { registration_date: value })
  end
end

[2.0.7]

  • Raise Datagrid::ConfigurationError when column or filter name specified in before or after option not found.
  • Fixed as_query method when dynamic filter is used. Fixes #344
grid = ProductsGrid.new(category: 'dresses', available: true, condition: ["price", ">=", 25])
# Before
grid.as_query 
  # => {
  #      category: 'dresses', 
  #      available: true, 
  #      condition: #<Object>
  #    }
# After
grid.as_query 
  # => {
  #      "category" => 'dresses', 
  #      "available" => true, 
  #      "condition" => { "field" => "price", "operation" => ">=", "value" => "25" }
  #    }

[2.0.6]

  • Validate dummy filter can not accept block

[2.0.5]

  • Add support for timestamptz ActiveRecord column type

[2.0.4]

  • Support Rails 8.1 #342
  • Support Ruby 3.4 #342

[2.0.3]

  • Fix default_column_options bug #338 by @pokonski.
  • Fix generator #336

[2.0.1]

  • Fixed search field type support #330
class UsersGrid < Datagrid::Base
  scope  { User }

  filter(
    :query, :string, input_options: { type: "search" }
  ) do |value, scope|
    scope.magic_search(value)
  end
end

Renders filter as:

<input type="search" name="users_grid[query]" id="users_grid_query"/>
  • Added support for default_filter_options and added lambda support for default_column_options #333 by @tmikoss.
class UsersGrid < Datagrid::Base
  scope { User }

  self.default_column_options = -> (column) {
    {header: I18n.t("datagrid.keywords.#{column.name}")}
  }

  self.default_filter_options = -> (filter) {
    {
      header: I18n.t("datagrid.keywords.user.#{filter.name}"),
      input_options: filter.type == :string ? {type: "textarea"} : {},
    }
  }
  
  filter(:first_name, :string)
  filter(:last_name, :string)

  column(:first_name)
  column(:last_name)
end

[2.0.0]

Version 2 is a major update implementing a lot of major improvements at the cost of backward compatibility.

Changes and migration guide

[1.8.3]

  • Fix rails hooking for version 7.1. #327
  • Fix formatting of value for date and datetime-local input types

[1.8.2]

  • Treat true/false as YES/NO when assigned as strings for xboolean filter.
  • Support infinite ranges for date, datetime and integer filters.
  • Treat ActiveRecord::Result class as Array driver.
  • Add Datagrid#reset method to reset a column cache.
  • Drop support of Rails 6.0 #326

[1.8.1]

  • Prioritize input_options over generated by default. #319

[1.8.0]

  • Support input_options: {type: "textarea"} as <textarea/> tag
  • Remove deprecated eboolean filter
  • Fixed scope wrapping to be universal
  • Deprecated integer_range_filters and date_range_filters. Use filter(name, type, range: true) instead.
  • Add original_scope method that returns scope as it was defined without any wrapping #313
  • Add ability to specify columns option for datagrid_row. #314

[1.7.0]

  • Depend on railties instead of rails to prevent loading of unnecessary frameworks
  • Bugfix File.exist? usage for Ruby 3.0 #307
  • Drop support of old Ruby versions (< 2.7) #305
  • Drop support of old Rails versions (< 6.0) #305

[1.6.3]

  • Fix usage of options spread operator for Ruby 3.0 #296

[1.6.2]

  • Add input_options and label_options to filter method #294
  • Fix <option> tag rendering for Rails 6.0

1.6.1 and before

Changes are not tracked