Sha256: b1d776f8662bb0b67ceb6c724aefa609ffe0f86db335719b4df0a5168ae43d04

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

module ExtDirect
  class Composite < Netzke::Base
    js_configure do |c|
      c.layout = :border
      c.border = true
      c.init_component = <<-JS
        function(){
          this.callParent();

          Ext.Ajax.on('beforerequest',function (conn, options ) {
            Netzke.connectionCount = Netzke.connectionCount || 0;
            Netzke.connectionCount++;
          });

          this.netzkeGetComponent('selector').on('userupdate', function(user){
            this.setUser(user);
            this.netzkeGetComponent('details').update();
            this.netzkeGetComponent('statistics').update();
          }, this);
        }
      JS
    end

    component :selector do |c|
      c.klass = ExtDirect::Selector # a form that will allow us to select a user
    end

    component :details do |c|
      c.klass = ExtDirect::Details # a panel that will display details for the user
      c.user = component_session[:user]
    end

    component :statistics do |c|
      c.klass = ExtDirect::Statistics # a panel that will display statistics for the user
      c.user = component_session[:user]
    end

    def configure(c)
      super
      c.items = [
        {:region => :north, :height => 100, component: :selector},
        {:region => :center, component: :details},
        {:region => :east, :width => 300, :split => true, component: :statistics}
      ]
    end

    endpoint :set_user do |params, this|
      component_session[:user] = params
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
netzke-core-0.8.4 test/core_test_app/app/components/ext_direct/composite.rb
netzke-core-0.8.3 test/core_test_app/app/components/ext_direct/composite.rb
netzke-core-0.8.2 test/core_test_app/app/components/ext_direct/composite.rb