Skip to content

Instantly share code, notes, and snippets.

@webhoernchen
Created October 27, 2010 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webhoernchen/648647 to your computer and use it in GitHub Desktop.
Save webhoernchen/648647 to your computer and use it in GitHub Desktop.
module Netzke
class UserGrid < Basepack::GridPanel
def default_config
config = super
config.merge({
:model => 'User',
:columns => [:first_name, :name, :email, :login,
{:name => :salutation, :editor => { :xtype => "combo", :store => [['mr', 'Herr'], ['mrs', 'Frau']] }},
:title, :confirmed_at, :locked_at]
})
end
end
end
@mxgrn
Copy link

mxgrn commented Oct 27, 2010

You may want to override GridPanel#default_fields_for_forms like this:

def default_fields_for_forms
  orig_fields = super.dup
  orig_fields.detect{ |f| f[:name] == "salutation" }.merge!(:xtype => "combo", :store => [['mr', 'Herr'], ['mrs', 'Frau']])
  orig_fields
end

default_fields_for_forms may even return an arbitrary layout of fields that will be common for all forms that the grid uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment