Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin_dbui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
w2pext
plugin_dbui
Commits
f6c69645
Commit
f6c69645
authored
14 years ago
by
Renaud Le Gac
Browse files
Options
Downloads
Patches
Plain Diff
Drat of the simplified version of the xgrid.
parent
d07a1825
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
static/plugin_dbui/src/appgrid.js
+99
-91
99 additions, 91 deletions
static/plugin_dbui/src/appgrid.js
with
99 additions
and
91 deletions
static/plugin_dbui/src/appgrid.js
+
99
−
91
View file @
f6c69645
/**
/**
* The Grid class is
a configured version of the GridPanel
* The Grid class is
Ext.grid.GridPanel with a Ext.PagingToolbar
* Many functionality can be added through grid plugins like
* Many functionality can be added through grid plugins like
* App.grid.RowEditor
ContextMenu
, ....
* App.grid.RowEditor, ....
*
*
* The type of this component is xgrid.
* The type of this component is xgrid.
*
*
...
@@ -15,96 +15,104 @@ Ext.namespace('App.grid');
...
@@ -15,96 +15,104 @@ Ext.namespace('App.grid');
App
.
grid
.
Grid
=
Ext
.
extend
(
Ext
.
grid
.
GridPanel
,
{
App
.
grid
.
Grid
=
Ext
.
extend
(
Ext
.
grid
.
GridPanel
,
{
/**
/**
* @cfg {Object} model Object to configure the widget
* private attributes used by plugins
* for a table of the database. It is provided by the server
* and contains the following keys:
*
* colModel: [...],
* formModel: [...],
* store: {},
* table: 'x',
* title: 'y',
* xtype: 'xgrid'
* }
*/
*/
model
:
null
,
rowEditor
:
null
/**
* pre-defined properties
*/
iconCls
:
'
silk-grid
'
,
frame
:
false
,
viewConfig
:
{
forceFit
:
true
},
/**
* private
* keep track of RowEditor set by the plugins like
* RowEditorToolBar, RowEditorContextMenu.
*/
editor
:
null
,
/**
* private method requests by the component model of ExtJS
*/
initComponent
:
function
()
{
if
(
!
this
.
model
)
{
throw
new
Error
(
"
the property model is missing !!!
"
);
}
// grid title
this
.
title
=
this
.
model
.
title
;
// the data store
this
.
store
=
new
App
.
data
.
JsonStore
({
url
:
App
.
dburl
,
model
:
this
.
model
.
store
,
debug
:
App
.
debug
});
// the columns model
this
.
columns
=
this
.
model
.
colModel
;
// empty top toolBar/bottomBar
this
.
tbar
=
[];
// empty Paging toolBar requires by the plugins
this
.
bbar
=
new
Ext
.
PagingToolbar
();
this
.
bbar
.
hide
();
// initialize the underlying class. DON'T MOVE
App
.
grid
.
Grid
.
superclass
.
initComponent
.
call
(
this
);
this
.
on
(
'
beforerender
'
,
this
.
onBeforeRender
);
},
/**
* Handler call before render. It is used to load the store
*
* NOTE:
* The way to load the store depends on the presence of the paging plugin.
* In this library the initialization sequence start with the initComponent
* followed by the initialization of the plugins followed by the render.
*
* @param {Object} grid
*/
onBeforeRender
:
function
(
grid
)
{
// is the paging plugin in the plugins list ?
var
isPagingPlugin
=
App
.
isPlugin
(
grid
,
'
pGridPaging
'
);
// load the store
// NOTE: when the paging is in action, need to recuperate the
// number of records. It is why we only ask the first one.
// When the store will be loaded, the paging plugin will tune
// the number of rows per page and will reload the store accordingly.
if
(
isPagingPlugin
)
{
grid
.
store
.
load
({
params
:
{
start
:
0
,
limit
:
1
}});
}
else
{
grid
.
store
.
load
();
}
return
true
;
}
});
});
Ext
.
reg
(
'
xgrid
'
,
App
.
grid
.
Grid
);
Ext
.
reg
(
'
xgrid
'
,
App
.
grid
.
Grid
);
//App.grid.Grid = Ext.extend(Ext.grid.GridPanel, {
//
// /**
// * @cfg {Object} model Object to configure the widget
// * for a table of the database. It is provided by the server
// * and contains the following keys:
// *
// * colModel: [...],
// * formModel: [...],
// * store: {},
// * table: 'x',
// * title: 'y',
// * xtype: 'xgrid'
// * }
// */
// model: null,
//
// /**
// * pre-defined properties
// */
// iconCls: 'silk-grid',
// frame: false,
// viewConfig: {forceFit: true},
//
// /**
// * private
// * keep track of RowEditor set by the plugins like
// * RowEditorToolBar, RowEditorContextMenu.
// */
// editor: null,
//
// /**
// * private method requests by the component model of ExtJS
// */
// initComponent: function () {
//
// if (!this.model) {
// throw new Error("the property model is missing !!!");
// }
//
// // grid title
// this.title = this.model.title;
//
// // the data store
// this.store = new App.data.JsonStore({
// url: App.dburl,
// model: this.model.store,
// debug: App.debug
// });
//
// // the columns model
// this.columns = this.model.colModel;
//
// // empty top toolBar/bottomBar
// this.tbar = [];
//
// // empty Paging toolBar requires by the plugins
// this.bbar = new Ext.PagingToolbar();
// this.bbar.hide();
//
// // initialize the underlying class. DON'T MOVE
// App.grid.Grid.superclass.initComponent.call(this);
//
// this.on('beforerender', this.onBeforeRender);
// },
//
// /**
// * Handler call before render. It is used to load the store
// *
// * NOTE:
// * The way to load the store depends on the presence of the paging plugin.
// * In this library the initialization sequence start with the initComponent
// * followed by the initialization of the plugins followed by the render.
// *
// * @param {Object} grid
// */
// onBeforeRender: function (grid) {
//
// // is the paging plugin in the plugins list ?
// var isPagingPlugin = App.isPlugin(grid, 'pGridPaging');
//
// // load the store
// // NOTE: when the paging is in action, need to recuperate the
// // number of records. It is why we only ask the first one.
// // When the store will be loaded, the paging plugin will tune
// // the number of rows per page and will reload the store accordingly.
// if (isPagingPlugin) {
// grid.store.load({params: {start: 0, limit: 1}});
// } else {
// grid.store.load();
// }
// return true;
// }
//});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment