mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
resize grids on browserwindow resize, see #10
This commit is contained in:
@@ -93,13 +93,32 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
autoExpandColumn: 'members',
|
autoExpandColumn: 'members',
|
||||||
store: groupStore,
|
store: groupStore,
|
||||||
colModel: groupColModel,
|
colModel: groupColModel,
|
||||||
emptyText: this.emptyGroupStoreText
|
emptyText: this.emptyGroupStoreText,
|
||||||
|
listeners: {
|
||||||
|
fallBelowMinHeight: {
|
||||||
|
fn: this.onFallBelowMinHeight,
|
||||||
|
scope: this
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||||
Sonia.group.Grid.superclass.initComponent.apply(this, arguments);
|
Sonia.group.Grid.superclass.initComponent.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
onFallBelowMinHeight: function(height, minHeight){
|
||||||
|
var p = Ext.getCmp('groupEditPanel');
|
||||||
|
this.setHeight(minHeight);
|
||||||
|
var epHeight = p.getHeight();
|
||||||
|
p.setHeight(epHeight - (minHeight - height));
|
||||||
|
// rerender
|
||||||
|
this.doLayout();
|
||||||
|
p.doLayout();
|
||||||
|
this.ownerCt.doLayout();
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
renderMembers: function(members){
|
renderMembers: function(members){
|
||||||
var out = '';
|
var out = '';
|
||||||
if ( members != null ){
|
if ( members != null ){
|
||||||
|
|||||||
@@ -132,13 +132,30 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
autoExpandColumn: 'description',
|
autoExpandColumn: 'description',
|
||||||
store: repositoryStore,
|
store: repositoryStore,
|
||||||
colModel: repositoryColModel,
|
colModel: repositoryColModel,
|
||||||
emptyText: this.emptyText
|
emptyText: this.emptyText,
|
||||||
|
listeners: {
|
||||||
|
fallBelowMinHeight: {
|
||||||
|
fn: this.onFallBelowMinHeight,
|
||||||
|
scope: this
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||||
Sonia.repository.Grid.superclass.initComponent.apply(this, arguments);
|
Sonia.repository.Grid.superclass.initComponent.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onFallBelowMinHeight: function(height, minHeight){
|
||||||
|
var p = Ext.getCmp('repositoryEditPanel');
|
||||||
|
this.setHeight(minHeight);
|
||||||
|
var epHeight = p.getHeight();
|
||||||
|
p.setHeight(epHeight - (minHeight - height));
|
||||||
|
// rerender
|
||||||
|
this.doLayout();
|
||||||
|
p.doLayout();
|
||||||
|
this.ownerCt.doLayout();
|
||||||
|
},
|
||||||
|
|
||||||
selectItem: function(item){
|
selectItem: function(item){
|
||||||
if ( debug ){
|
if ( debug ){
|
||||||
console.debug( item.name + ' selected' );
|
console.debug( item.name + ' selected' );
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
|
|||||||
mailtoTemplate: '<a href="mailto: {0}">{0}</a>',
|
mailtoTemplate: '<a href="mailto: {0}">{0}</a>',
|
||||||
checkboxTemplate: '<input type="checkbox" disabled="true" {0}/>',
|
checkboxTemplate: '<input type="checkbox" disabled="true" {0}/>',
|
||||||
emptyText: 'No items available',
|
emptyText: 'No items available',
|
||||||
|
minHeight: 150,
|
||||||
|
|
||||||
initComponent: function(){
|
initComponent: function(){
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
minHeight: 150,
|
minHeight: this.minHeight,
|
||||||
loadMask: true,
|
loadMask: true,
|
||||||
sm: selectionModel,
|
sm: selectionModel,
|
||||||
viewConfig: {
|
viewConfig: {
|
||||||
@@ -99,6 +100,10 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.addEvents('fallBelowMinHeight');
|
||||||
|
|
||||||
|
Ext.EventManager.onWindowResize(this.resize, this);
|
||||||
|
|
||||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||||
Sonia.rest.Grid.superclass.initComponent.apply(this, arguments);
|
Sonia.rest.Grid.superclass.initComponent.apply(this, arguments);
|
||||||
|
|
||||||
@@ -109,6 +114,24 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
|
|||||||
this.store.load();
|
this.store.load();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resize: function(){
|
||||||
|
var h = this.getHeight();
|
||||||
|
if (debug){
|
||||||
|
console.debug('' + h + ' < ' + this.minHeight + " = " + (h < this.minHeight));
|
||||||
|
}
|
||||||
|
if ( h < this.minHeight ){
|
||||||
|
if ( debug ){
|
||||||
|
console.debug( 'fire event fallBelowMinHeight' );
|
||||||
|
}
|
||||||
|
this.fireEvent('fallBelowMinHeight', h, this.minHeight);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onDestroy: function(){
|
||||||
|
Ext.EventManager.removeResizeListener(this.resize, this);
|
||||||
|
Sonia.rest.Grid.superclass.onDestroy.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
reload: function(){
|
reload: function(){
|
||||||
if ( debug ){
|
if ( debug ){
|
||||||
console.debug('reload store');
|
console.debug('reload store');
|
||||||
|
|||||||
@@ -99,13 +99,30 @@ Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
store: userStore,
|
store: userStore,
|
||||||
colModel: userColModel
|
colModel: userColModel,
|
||||||
|
listeners: {
|
||||||
|
fallBelowMinHeight: {
|
||||||
|
fn: this.onFallBelowMinHeight,
|
||||||
|
scope: this
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||||
Sonia.user.Grid.superclass.initComponent.apply(this, arguments);
|
Sonia.user.Grid.superclass.initComponent.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onFallBelowMinHeight: function(height, minHeight){
|
||||||
|
var p = Ext.getCmp('userEditPanel');
|
||||||
|
this.setHeight(minHeight);
|
||||||
|
var epHeight = p.getHeight();
|
||||||
|
p.setHeight(epHeight - (minHeight - height));
|
||||||
|
// rerender
|
||||||
|
this.doLayout();
|
||||||
|
p.doLayout();
|
||||||
|
this.ownerCt.doLayout();
|
||||||
|
},
|
||||||
|
|
||||||
selectItem: function(item){
|
selectItem: function(item){
|
||||||
if ( debug ){
|
if ( debug ){
|
||||||
console.debug( item.name + ' selected' );
|
console.debug( item.name + ' selected' );
|
||||||
|
|||||||
Reference in New Issue
Block a user