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
51101337
Commit
51101337
authored
12 years ago
by
LE GAC Renaud
Browse files
Options
Downloads
Patches
Plain Diff
Add the configuration parameter nRows, the method reset and the event
resetgrid.
parent
a1300cc3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
static/plugin_dbui/src/grid.js
+56
-2
56 additions, 2 deletions
static/plugin_dbui/src/grid.js
with
56 additions
and
2 deletions
static/plugin_dbui/src/grid.js
+
56
−
2
View file @
51101337
...
...
@@ -14,6 +14,18 @@ Ext.namespace('App.grid');
App
.
grid
.
Grid
=
Ext
.
extend
(
Ext
.
grid
.
GridPanel
,
{
/**
* @cfg nRows integer
* Default number of rows display in the grid.
* This parameter is only use when running with a paging plugin.
*/
nRows
:
10
,
/**
* @event resetgrid
* Can be used to reset underlying plugin when the reset
* method is triggered
*/
/**
* private attributes used by plugins
*/
...
...
@@ -49,18 +61,60 @@ App.grid.Grid = Ext.extend(Ext.grid.GridPanel, {
// empty toolBar requires by the plugins
this
.
bbar
=
new
Ext
.
Toolbar
();
// initiali
z
e the underlying class. DON'T MOVE
// initiali
s
e the underlying class. DON'T MOVE
App
.
grid
.
Grid
.
superclass
.
initComponent
.
call
(
this
);
// load the store if not yet done
// if the grid paging is used load only the first 10 rows
if
(
!
this
.
store
.
getTotalCount
())
{
if
(
App
.
isPlugin
(
this
,
'
pGridPaging
'
))
{
this
.
store
.
load
({
params
:
{
start
:
0
,
limit
:
10
}});
this
.
store
.
load
({
params
:
{
start
:
0
,
limit
:
this
.
nRows
}});
}
else
{
this
.
store
.
load
();
}
}
},
/**
* reset the grid
* The store is load with fresh data and the event 'resetgrid' is emitted.
* Paging and slider plugin might be reset using the 'resetgrid' event.
* GridFilter object can be also reset using the same mechanism.
*
* The scope is the grid
*
*/
reset
:
function
()
{
var
action
,
i
;
// private function to emitt the resetgrid event
function
fireReset
()
{
this
.
fireEvent
(
'
resetgrid
'
);
}
// parameters for the store load action
action
=
{
callback
:
fireReset
,
scope
:
this
};
if
(
this
.
getBottomToolbar
()
instanceof
Ext
.
PagingToolbar
)
{
action
.
params
=
{
start
:
0
,
limit
:
this
.
nRows
};
}
// restore initial where condition of the store
// in order to remove filter condition
if
(
'
where
'
in
this
.
store
.
baseParams
)
{
if
(
this
.
store
.
initialWhere
)
{
this
.
store
.
baseParams
.
where
=
[];
for
(
i
=
0
;
i
<
this
.
store
.
initialWhere
.
length
;
i
+=
1
)
{
this
.
store
.
baseParams
.
where
.
push
(
this
.
store
.
initialWhere
[
i
]);
}
}
else
{
delete
this
.
store
.
baseParams
.
where
;
}
}
// reload the store and fire the resetgrid event
this
.
store
.
load
(
action
);
}
});
...
...
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