Sha256: c571a12c85a8bf6a293d041c711db109221ad2db70feea4f11238eab8460ac0b

Contents?: true

Size: 1.73 KB

Versions: 17

Compression:

Stored size: 1.73 KB

Contents

module ErpApp
  module Extensions
    module Railties
      module ActionView
        module Helpers
          module ExtjsHelper

            # example usage:
            # <%= dynamic_extjs_grid({
            #   :title => 'Accounts',
            #   :renderTo => 'grid_target',
            #   :setupUrl => build_widget_url(:accounts_grid_setup),
            #   :dataUrl => build_widget_url(:accounts_grid_data),
            #   :width => 500,
            #   :height => 200,
            #   :page => true,
            #   :pageSize => 5,
            #   :displayMsg => 'Displaying {0} - {1} of {2}',
            #   :emptyMsg => 'Empty',
            #   :storeId => "my_unique_store_id"   #this is an optional field
            # }) %>
            def dynamic_extjs_grid(options={})
              options[:title] = '' if options[:title].blank?
              options[:closable] = false if options[:closable].blank?
              options[:collapsible] = false if options[:collapsible].blank?
              options[:height] = 300 if options[:height].blank?
              
              output = raw '<script type="text/javascript">'
              output += raw "Compass.ErpApp.Utility.JsLoader.load([
                    '/javascripts/erp_app/shared/dynamic_editable_grid.js',
                    '/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js'],
                    function(){
                      Ext.create('Compass.ErpApp.Shared.DynamicEditableGridLoaderPanel', #{options.to_json} );
                    });"
              output += raw '</script>'

              output
            end

          end#ExtjsHelper
        end#Helpers
      end#ActionView
    end#Railties
  end#Extensions
end#ErpApp

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
erp_app-3.0.16 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.15 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.1.1 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.1.0 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.14 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.13 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.12 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.10 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.9 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.8 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.7 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.6 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.5 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.4 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.3 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.2 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb
erp_app-3.0.1 lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb