WiceGrid version 0.5

Today WiceGrid has reached the next level of maturity and was awarded the tag of version 0.5 .

This version of WiceGrid is accompanied by an application called WiceGrid Examples running online and with source code available on GitHub.

Here’s a list of changes as compared with version 0.4 :


Method selected_records of WiceGrid instances allows to access the list of all records of the current selection throughout all pages in the context of a view:

See an online example

placement of filter related icons

A change in placement of filter related icons (filter icon, reset icon, show/hide icon): if the last column doesn’t have any filter or a column name, icons will be placed in the header of this column, otherwise it falls back to the usual behavior when an additional table column is added. To change the behavior back to the old style, set Wice::Defaults::REUSE_LAST_COLUMN_FOR_FILTER_ICONS to false in the configuration file.

See an online example

wice_grid_assets generator

Copying asset files (images, css, js, and the configuration file) is now done by a plugin generator, not rake tasks:

./script/generate wice_grid_assets

blank slate

Blank slate feature: it is now possible to replace the grid with some alternative view if no filters are active and there are no records to render:

There are also two alternative three ways to do it:

g.blank_slate "some text to be rendered"


g.blank_slate :partial => "partial_name"

See an online example

custom filters with symbols

Improvement to custom filters, namely to

:custom_filter => :symbol

:custom_filter => [:symbol1, :symbol2, :symbol3]

Now, if the last method returns an array of 2 elements, the first element becomes the select option label and the second – the select option value (usually id).

Before this change the value returned by the method had been used for both the value and the label of the select option.

See an online example

custom filters and NULL

Values null and not null in a generated custom filter dropdown are treated specially, as SQL null statement and not as strings. Value null is transformed into SQL condition IS NULL, and not null into IS NOT NULL .

Thus, if in a filter defined by

:custom_filter => {'No' => 'null', 'Yes' => 'not null', '1' => 1, '2' => '2', '3' => '3'}

values 1, 2 and 'No' are selected (in a multi-select mode), this will result in the following SQL:

( table.field IN ( '1', '2' ) OR table.field IS NULL )

See an online example


in addition to the configuration constant Wice::Defaults::STRING_MATCHING_OPERATOR to define the operator for matching strings (LIKE in most cases), hash Wice::Defaults::STRING_MATCHING_OPERATORS was added to specify string matching operators on per-database basis:
 'ActiveRecord::ConnectionAdapters::MysqlAdapter' => 'LIKE',
 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' => 'ILIKE'

A use-case for this is a Rails application connecting to two databases, one of which is MySQL, and the other is Postgresql. To use case-insensitive matching in Postgresql ‘ILIKE’ has to be used, but this operator is unknown to MySQL.

td_html_attrs and table_html_attrs shortcuts

:td_html_attrs in column definitions and table_html_attrs in the table definitions are mostly used to add css classes, so a shorter way has been added to add css classes.

Instead of

It’s possible to just use the new :class option:


New options for column: :allow_multiple_selection, use :allow_multiple_selection => false to disable switching between single and multiple selection modes for custom dropdown boxes.

See an online example


New parameter for column: :allow_ordering. Use :allow_ordering => false to disable the ordering of the column.

See an online example


Parameter :allow_showing_all_records moved from initialize_grid to the view helper.


  • Default styles updated.
  • Javascript code cleaned up and refactored.
  • Quite some number of bugs fixed

Play with examples, read the docs, and get WiceGrid version 0.5 here.