mirror of https://github.com/fspc/BikeShed-1.git
Browse Source
User a transactions border, select the customer from a view of users and customersdenney-disable-on-select
Jason Denney
12 years ago
5 changed files with 74 additions and 49 deletions
@ -0,0 +1,30 @@ |
|||||
|
class TransactionsBorder < Netzke::Base |
||||
|
# Remember regions collapse state and size |
||||
|
include Netzke::Basepack::ItemPersistence |
||||
|
#users and customers components are required for the transactions form |
||||
|
component :transactions |
||||
|
component :users |
||||
|
component :customers |
||||
|
|
||||
|
def configure(c) |
||||
|
super |
||||
|
c.header = false |
||||
|
c.items = [ |
||||
|
{ netzke_component: :transactions, region: :west, width: 300, split: true }, |
||||
|
{ netzke_component: :users, region: :center, width: 300, split: true }, |
||||
|
{ netzke_component: :customers, region: :east, width: 300, split: true } |
||||
|
] |
||||
|
end |
||||
|
|
||||
|
js_configure do |c| |
||||
|
c.layout = :border |
||||
|
c.border = false |
||||
|
c.mixin :init_component |
||||
|
end |
||||
|
|
||||
|
endpoint :select_customer do |params, this| |
||||
|
session[:selected_customer_id] = params[:customer_id] |
||||
|
session[:selected_customer_type] = params[:customer_type] |
||||
|
end |
||||
|
|
||||
|
end |
@ -0,0 +1,17 @@ |
|||||
|
{ |
||||
|
initComponent: function(){ |
||||
|
// calling superclass's initComponent
|
||||
|
this.callParent(); |
||||
|
|
||||
|
// setting the 'rowclick' event
|
||||
|
var user_view = this.getComponent('users').getView(); |
||||
|
var customer_view = this.getComponent('users').getView(); |
||||
|
user_view.on('itemclick', function(view, record){ |
||||
|
// The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
|
||||
|
this.selectCustomer({customer_id: record.get('id'), customer_type: 'User'}); |
||||
|
}, this); |
||||
|
customer_view.on('itemclick', function(view, record){ |
||||
|
this.selectCustomer({customer_id: record.get('id'), customer_type: 'Customer'}); |
||||
|
}, this); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue