commit a02a9039a6b3005ee2d46759ba9b02c6f0e3929f
parent f3d0354f6e266d6845c37b14255fdb202de7d3a9
Author: Felicitus <felicitus@felicitus.org>
Date: Sun, 25 Dec 2011 05:44:14 +0100
Added part group expand/collapse. Fixes #110
Diffstat:
4 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/src/frontend/js/Components/Part/PartsGrid.js b/src/frontend/js/Components/Part/PartsGrid.js
@@ -13,7 +13,10 @@ Ext.define('PartKeepr.PartsGrid', {
addButtonIcon: 'resources/silkicons/brick_add.png',
deleteButtonText: i18n("Delete Part"),
deleteButtonIcon: 'resources/silkicons/brick_delete.png',
-
+
+ expandRowButtonIcon: 'resources/icons/group-expand.png',
+ collapseRowButtonIcon: 'resources/icons/group-collapse.png',
+
viewConfig: {
plugins: {
ddGroup: 'CategoryTree',
@@ -28,7 +31,7 @@ Ext.define('PartKeepr.PartsGrid', {
invalidateScrollerOnRefresh: true,
initComponent: function () {
- var groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
+ this.groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
//enableGroupingMenu: false,
groupHeaderTpl: '{name} ({rows.length} ' + i18n("Part(s)")+")"
});
@@ -37,7 +40,7 @@ Ext.define('PartKeepr.PartsGrid', {
this.defineColumns();
- this.features = [groupingFeature];
+ this.features = [this.groupingFeature];
this.on("itemdblclick", this.onDoubleClick, this);
@@ -55,6 +58,27 @@ Ext.define('PartKeepr.PartsGrid', {
// Initialize the panel
this.callParent();
+ this.bottomToolbar.add({
+ xtype: 'button',
+ tooltip: i18n("Expand all Groups"),
+ icon: this.expandRowButtonIcon,
+ listeners: {
+ scope: this.groupingFeature,
+ click: this.groupingFeature.expandAll
+ }
+
+ });
+
+ this.bottomToolbar.add({
+ xtype: 'button',
+ tooltip: i18n("Collapse all Groups"),
+ icon: this.collapseRowButtonIcon,
+ listeners: {
+ scope: this.groupingFeature,
+ click: this.groupingFeature.collapseAll
+ }
+ });
+
},
/**
* Called when the record was double-clicked
diff --git a/src/frontend/js/ExtJS/Enhancements/Ext.grid.feature.Grouping.expandCollapseAll.js b/src/frontend/js/ExtJS/Enhancements/Ext.grid.feature.Grouping.expandCollapseAll.js
@@ -0,0 +1,17 @@
+Ext.override(Ext.grid.feature.Grouping, {
+ collapseAll: function() {
+ var self = this, view = self.view;
+ view.el.query('.x-grid-group-hd').forEach(function (group) {
+ var group_body = Ext.fly(group.nextSibling, '_grouping');
+ self.collapse(group_body);
+ });
+ },
+
+ expandAll: function() {
+ var self = this, view = self.view;
+ view.el.query('.x-grid-group-hd').forEach(function (group) {
+ var group_body = Ext.fly(group.nextSibling, '_grouping');
+ self.expand(group_body);
+ });
+ }
+ });+
\ No newline at end of file
diff --git a/src/frontend/resources/icons/group-collapse.png b/src/frontend/resources/icons/group-collapse.png
Binary files differ.
diff --git a/src/frontend/resources/icons/group-expand.png b/src/frontend/resources/icons/group-expand.png
Binary files differ.