Class: Marty::DataGridView
- Inherits:
-
McflyGridPanel
- Object
- Netzke::Grid::Base
- Grid
- McflyGridPanel
- Marty::DataGridView
- Includes:
- Extras::Layout
- Defined in:
- app/components/marty/data_grid_view.rb
Constant Summary
Constants included from Extras::Layout
Extras::Layout::BOOL_MAP, Extras::Layout::MAP_BOOL
Constants included from Permissions
Permissions::ALL_ROLES, Permissions::REQ_ROLES
Class Method Summary collapse
Instance Method Summary collapse
- #configure(c) ⇒ Object
- #default_bbar ⇒ Object
- #default_context_menu ⇒ Object
- #default_form_items ⇒ Object
Methods included from Extras::Layout
#bool_getter, #bool_setter, #dispfield, #enum_array, #enum_column, #enum_setter, #fieldset, #hbox, #hspacer, #jsonb_field, #nullable_bool_column, #range_column, #range_field, #range_getter, #range_setter, #textarea_field, #vbox, #vspacer
Methods inherited from McflyGridPanel
#augment_attribute_config, #get_records
Methods inherited from Grid
#class_can?, #configure_form_window, #get_json_sorter, #has_search_action?
Methods included from Permissions
#can_perform_action?, #can_perform_actions, #current_user_roles, #has_any_perm?, #has_marty_permissions
Class Method Details
.client_show_grid_js ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/components/marty/data_grid_view.rb', line 25 def self.client_show_grid_js javascript = l(<<-JS) function(count, data, title_str) { var columns = []; var fields = []; for (var i=0; i<count; i++) { fields.push("a" + i); columns.push({dataIndex: "a" + i, text: i, flex: 1}); } Ext.create('Ext.Window', { height: "80%", width: "80%", x: 0, y: 0, autoWidth: true, modal: true, autoScroll: true, title: title_str, items: { xtype: 'grid', border: false, hideHeaders: false, columns: columns, store: Ext.create('Ext.data.ArrayStore', { fields: fields, data: data, }) }, }).show(); } JS javascript end |
.show_grid_js(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/marty/data_grid_view.rb', line 9 def self.show_grid_js(={}) dg = [:data_grid] || 'data_grid' title_str = [:title_str] || 'Data Grid' javascript = l(<<-JS) function() { var sel = this.getSelectionModel().getSelection()[0]; var record_id = sel && sel.getId(); this.server.showGrid({record_id: record_id, data_grid: "#{dg}", title_str: "#{title_str}"}); } JS javascript end |
Instance Method Details
#configure(c) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/components/marty/data_grid_view.rb', line 66 def configure(c) super c.title = I18n.t('data_grid') c.model = "Marty::DataGrid" c.attributes = [ :name, :vcols, :hcols, :lenient, :data_type, :created_dt, ] c.store_config.merge!({sorters: [{property: :name, direction: 'ASC'}]}) c.editing = :in_form c.paging = :pagination c.multi_select = false end |
#default_bbar ⇒ Object
142 143 144 |
# File 'app/components/marty/data_grid_view.rb', line 142 def [:show_grid] + super end |
#default_context_menu ⇒ Object
146 147 148 |
# File 'app/components/marty/data_grid_view.rb', line 146 def [] end |
#default_form_items ⇒ Object
150 151 152 153 154 155 |
# File 'app/components/marty/data_grid_view.rb', line 150 def default_form_items [ :name, textarea_field(:export, height: 300, hide_label: true), ] end |