Clear session variables when component unloads

24 views
Skip to first unread message

Jorge Segura

unread,
Dec 10, 2013, 6:49:11 PM12/10/13
to net...@googlegroups.com
Hi, I wonder if there is an endpoint for a netzke component that I could override when the component 'unloads'.
I need to clear some session variables just before the components 'unloads', just like this:

endpoint :cmp_unloads |params, this|
     session[:var1] = nil
     session[:var2] = nil
     super(params, this)
end

or maybe there is a simpler way of doing this.

I hope you can help me.
Netzke rocks!

Praveen K

unread,
Dec 11, 2013, 1:07:00 AM12/11/13
to net...@googlegroups.com
Hi Jorge Segura,

You can do this by adding destroy event to component. Ex:

this.on('destroy', function(view, record){
    this.unloadNetzkeComponentInServer();
}, this);
 
endpoint :unload_netzke_component_in_server do |params|
     session.keys.select{|k| k.starts_with?("#{self.global_id}__")}.each {|k| session.delete(k)}
     session.delete(self.global_id)
     {}
 end
Reply all
Reply to author
Forward
0 new messages