Author: abelevich
Date: 2010-05-28 06:43:15 -0400 (Fri, 28 May 2010)
New Revision: 17346
Added:
root/ui-sandbox/tables/trunk/ui/src/main/resources/META-INF/resources/subtable-toggler.js
Log:
Added:
root/ui-sandbox/tables/trunk/ui/src/main/resources/META-INF/resources/subtable-toggler.js
===================================================================
---
root/ui-sandbox/tables/trunk/ui/src/main/resources/META-INF/resources/subtable-toggler.js
(rev 0)
+++
root/ui-sandbox/tables/trunk/ui/src/main/resources/META-INF/resources/subtable-toggler.js 2010-05-28
10:43:15 UTC (rev 17346)
@@ -0,0 +1,49 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.SubTableToggler = function(id, options) {
+ this.id = id;
+ this.eventName = options.eventName;
+ this.expandControl = options.expandControl;
+ this.collapseControl = options.collapseControl;
+ this.forId = options.forId;
+
+ richfaces.Event.bindById(this.id, this.eventName, this.toggle, this);
+ };
+
+ $.extend(richfaces.ui.SubTableToggler.prototype, (function () {
+
+ var getElementById= function(id) {
+ return $(document.getElementById(id))
+ }
+
+ return {
+
+ toggle: function(e) {
+ var subtable = richfaces.$(this.forId);
+ if(subtable) {
+ this.toggleControl(subtable.isExpand());
+ subtable.setOption(this.id);
+ subtable.toggle(e);
+ }
+ },
+
+ toggleControl: function(expanded) {
+ var expandControl = getElementById(this.expandControl);
+ var collapseControl = getElementById(this.collapseControl);
+
+ if(expanded) {
+ collapseControl.hide();
+ expandControl.show();
+ } else {
+ expandControl.hide();
+ collapseControl.show();
+ }
+ }
+
+ };
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Show replies by date