mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
added sonia.rest.Grid
This commit is contained in:
@@ -33,23 +33,10 @@
|
||||
Ext.ns('Sonia.user');
|
||||
|
||||
// UserGrid
|
||||
Sonia.user.Grid = Ext.extend(Ext.grid.GridPanel, {
|
||||
|
||||
mailtoTemplate: '<a href="mailto: {0}">{0}</a>',
|
||||
Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
|
||||
initComponent: function(){
|
||||
|
||||
var selectionModel = new Ext.grid.RowSelectionModel({
|
||||
singleSelect: true
|
||||
});
|
||||
|
||||
selectionModel.on({
|
||||
selectionchange: {
|
||||
scope: this,
|
||||
fn: this.selectionChanged
|
||||
}
|
||||
});
|
||||
|
||||
var userStore = new Sonia.rest.JsonStore({
|
||||
url: restUrl + 'users.json',
|
||||
root: 'users',
|
||||
@@ -74,43 +61,19 @@ Sonia.user.Grid = Ext.extend(Ext.grid.GridPanel, {
|
||||
});
|
||||
|
||||
var config = {
|
||||
loadMask: true,
|
||||
store: userStore,
|
||||
colModel: userColModel,
|
||||
sm: selectionModel
|
||||
colModel: userColModel
|
||||
};
|
||||
|
||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||
Sonia.user.Grid.superclass.initComponent.apply(this, arguments);
|
||||
|
||||
// load data
|
||||
if ( debug ){
|
||||
console.debug( 'load user list' );
|
||||
}
|
||||
userStore.load();
|
||||
},
|
||||
|
||||
reload: function(){
|
||||
if ( debug ){
|
||||
console.debug('reload store');
|
||||
}
|
||||
this.store.load();
|
||||
},
|
||||
|
||||
selectionChanged: function(sm){
|
||||
var selected = sm.getSelected();
|
||||
if ( selected ){
|
||||
if ( debug ){
|
||||
console.debug( selected.data.name + ' selected' );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
renderMailto: function(mail){
|
||||
return String.format( this.mailtoTemplate, mail );
|
||||
selectItem: function(item){
|
||||
console.debug( item );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// register xtype
|
||||
Ext.reg('userGrid', Sonia.user.Grid);
|
||||
Ext.reg('userGrid', Sonia.user.Grid);
|
||||
|
||||
Reference in New Issue
Block a user