Author: pyaschenko
Date: 2010-01-20 05:52:25 -0500 (Wed, 20 Jan 2010)
New Revision: 16341
Modified:
root/examples-sandbox/trunk/javascripts-draft/position/1.html
Log:
RichFaces.Event sample draft
Modified: root/examples-sandbox/trunk/javascripts-draft/position/1.html
===================================================================
--- root/examples-sandbox/trunk/javascripts-draft/position/1.html 2010-01-20 10:39:34 UTC
(rev 16340)
+++ root/examples-sandbox/trunk/javascripts-draft/position/1.html 2010-01-20 10:52:25 UTC
(rev 16341)
@@ -18,23 +18,24 @@
*/
function a (id, namespace) {
this.getComponentName = function() {return "a"};
- this.getNamespace = function() {return
'.rf.'+this.getComponentName()+'.'+this.id+(namespace ?
'.'+namespace : '');}
+ this.namespace = RichFaces.Event.createNamespace(this.getComponentName(), id);
+ if (namespace) this.namespace+="."+namespace;
this.onClick = function(event) {
alert(event.data.component.getComponentName());
};
this.clearEventHandlers = function() {
- RichFaces.Event.unbind(id,'click'+this.getNamespace());
+ RichFaces.Event.unbind(id,'click.'+this.namespace);
}
this.id = id;
jQuery(id).component = this;
- RichFaces.Event.bind(id,'click'+this.getNamespace(), this.onClick, this);
+ RichFaces.Event.bind(id,'click.'+this.namespace, this.onClick, this);
};
- var _a = new a('#aaa');
+ var _a = new a('#aaa','0');
alert(_a.getComponentName());
var _b = new a('#bbb');
- var _aa = new a('#aaa');
- //_a.clearEventHandlers();
+ var _aa = new a('#aaa','1');
+ _a.clearEventHandlers();
</script>
</boby>
</html>
\ No newline at end of file