Author: konstantin.mishin
Date: 2007-06-21 11:00:42 -0400 (Thu, 21 Jun 2007)
New Revision: 1258
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
Log:
add selection JS events
Modified:
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
===================================================================
---
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-06-21
14:55:37 UTC (rev 1257)
+++
trunk/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-06-21
15:00:42 UTC (rev 1258)
@@ -108,7 +108,39 @@
}
}
}
- },
+ },
+
+ getState: function() {
+ var s = this.clone();
+ return {
+ size: function() {
+ return s.size();
+ },
+
+ each: function(iterator) {
+ s.each(iterator);
+ },
+
+ isSelected: function(id) {
+ return s.isSelectedId(id);
+ }
+ };
+ },
+
+ clone: function() {
+ var ret = Object.extend(new Object(),this);
+ ret.ranges = new Array(ret.ranges.length);
+ for (var i = 0; i < ret.ranges.length; i++) {
+ ret.ranges[i] = this.ranges[i].clone();
+ }
+ return ret;
+ },
+
+ each: function(iterator) {
+ for (var i = 0; i < this.ranges.length; i++) {
+ this.ranges[i].each(iterator);
+ }
+ },
getRanges: function() {
return this.ranges;
@@ -245,6 +277,7 @@
}
i++;
}
+ this.oldState = this.selection.getState();
},
setListeners: function() {
@@ -354,7 +387,7 @@
this.lostFocus();
}
if (noDefault) {
- $(this.inputElement).value = this.selection.inspectRanges() + this.selectionFlag;
+ this.selectionChanged();
if (event.preventBubble) event.preventBubble();
Event.stop(event);
}
@@ -398,7 +431,14 @@
} else if (document.selection) {
document.selection.empty();
}
+ this.selectionChanged();
+ },
+
+ selectionChanged: function() {
$(this.inputElement).value = this.selection.inspectRanges()+ this.selectionFlag;
+ var state = this.selection.getState();
+// IL.Event.fireEvent(this.grid.element, "selectionchange", {oldSelection:
this.oldState, newSelection: state}, null);
+ this.oldState = state;
},
setShiftRow: function(event) {
Show replies by date