Module: Netzke::Basepack::ActionColumn
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/netzke/basepack/action_column.rb
Overview
An extension for Grid that allows specifying (multiple) action columns. Example:
class Books < Netzke::Grid::Base
include Netzke::Basepack::ActionColumn
def configure(c)
c.model = "Book"
super
end
def columns
super + [:actions]
end
column :actions do |c|
c.type = :action
c.actions = [
# default handler will be on_delete_row
{name: :delete_row, tooltip: "Delete row", icon: :delete}
# feel free to define more actions in this column
]
end
client_class do |c|
# handler for column action 'delete_row'
c.on_delete_row = l(<<-JS)
function(record){
this.getSelectionModel().select(record);
this.onDel();
}
JS
end
end
Instance Method Summary collapse
Instance Method Details
#augment_column_config(c) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/netzke/basepack/action_column.rb', line 41 def augment_column_config(c) super if c.type == :action c.xtype = :actioncolumn c.items = c.actions.map {|a| build_action_config(a)}.netzke_jsonify end end |