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
58914512
Commit
58914512
authored
11 years ago
by
LE GAC Renaud
Browse files
Options
Downloads
Patches
Plain Diff
ExtJS 4.2: Remove the pGridPaging plugin.
parent
1a5a91a6
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/pgridpaging.js
+0
-196
0 additions, 196 deletions
static/plugin_dbui/src/pgridpaging.js
with
0 additions
and
196 deletions
static/plugin_dbui/src/pgridpaging.js
deleted
100644 → 0
+
0
−
196
View file @
1a5a91a6
/**
* The grid plugin instantiating the paging bottom bar.
* It contains the widget to navigate between page and a slider
* to fixed the number of rows per page.
*
* **Note**: the number of row load in the grid at the first time
* is defined by the grid when loading the store.
*
*/
Ext
.
define
(
'
App.grid.Paging
'
,
{
extend
:
'
Object
'
,
alias
:
'
plugin.pGridPaging
'
,
// Private property for internationalisation
textSlider
:
'
Rows per page
'
,
/**
* The plugin initialization
*
* @param {App.grid.Grid} grid
*
*/
init
:
function
(
grid
)
{
"
use strict
"
;
var
bbar
;
// create the paging bar
bbar
=
new
Ext
.
PagingToolbar
({
store
:
grid
.
store
});
// replace the bottom toolbar by the paging toolbar
Ext
.
destroyMembers
(
grid
,
'
bottomToolbar
'
);
grid
.
bottomToolbar
=
bbar
;
// add slider
bbar
.
add
(
'
-
'
,
this
.
textSlider
,
{
xtype
:
'
slider
'
,
plugins
:
new
Ext
.
slider
.
Tip
(),
listeners
:
{
changecomplete
:
this
.
onChangePageSize
,
scope
:
bbar
},
minValue
:
1
,
width
:
100
},
'
-
'
);
// Initialise the parameters of the paging and slider widgets.
// Depends on the status of the store.
// Initialisation is only performed once.
if
(
grid
.
store
.
getTotalCount
()
>
0
)
{
this
.
onInit
.
call
(
grid
,
grid
.
store
);
}
else
{
grid
.
store
.
on
(
'
load
'
,
this
.
onInit
,
grid
,
{
single
:
true
});
}
// update the slider parameter after a write action
// which destroy and create records
grid
.
store
.
on
(
'
write
'
,
this
.
onWrite
,
grid
);
// reset paging and slide parameter on a grid reset
grid
.
on
(
'
resetgrid
'
,
this
.
onReset
,
grid
);
},
//
// Private method to destroy the plugin.
// Reset the slider and the paging parameters to default values.
// Purge grid and store listeners associated to the plugin.
// Destroy the bottom toolbar.
//
// @param {App.grid.Grid} grid
//
destroyPlugin
:
function
(
grid
)
{
"
use strict
"
;
var
slider
;
// purge listeners
grid
.
store
.
un
(
'
write
'
,
this
.
onWrite
,
grid
);
grid
.
un
(
'
resetgrid
'
,
this
.
onReset
,
grid
);
// destroy slider tooltip
slider
=
grid
.
bottomToolbar
.
findByType
(
'
slider
'
)[
0
];
Ext
.
destroyMembers
(
slider
,
'
plugins
'
);
},
/**
* Fire when the slider value is change by the user.
* The scope is the bottom tool bar.
*
* @param {Ext.slider.SingleSlider} slider
*
* @param {Number} newValue
* The new value which the slider has been changed too.
*
* @param {Ext.slider.Thumb} thumb
* the thumb that was changed.
*
*/
onChangePageSize
:
function
(
slider
,
newValue
,
thumb
)
{
"
use strict
"
;
var
bbar
=
this
;
bbar
.
pageSize
=
newValue
;
bbar
.
moveFirst
();
},
/**
* Initialise the number of rows per page and the number of page.
* It is fired during the initialization or when the store is loaded.
* The scope is the grid.
*
* @param {Ext.data.Store} store
*
* @param {Ext.data.Record[]} records
* The records that were loaded.
*
* @param {Object} options
* The loading option that where specified.
*/
onInit
:
function
(
store
,
records
,
options
)
{
"
use strict
"
;
var
bbar
,
grid
=
this
,
nRecords
=
store
.
getTotalCount
(),
nRows
,
slider
;
nRows
=
grid
.
nRows
;
bbar
=
grid
.
getBottomToolbar
();
bbar
.
pageSize
=
nRows
;
bbar
.
moveFirst
();
slider
=
bbar
.
findByType
(
'
slider
'
)[
0
];
slider
.
setMaxValue
(
nRecords
);
slider
.
setValue
(
nRows
);
},
/**
* Reset the paging parameters.
* The scope is the grid.
*
*/
onReset
:
function
()
{
"
use strict
"
;
var
bbar
,
grid
=
this
,
slider
;
bbar
=
grid
.
getBottomToolbar
();
bbar
.
pageSize
=
grid
.
nRows
;
bbar
.
moveFirst
();
slider
=
bbar
.
findByType
(
'
slider
'
)[
0
];
slider
.
setMaxValue
(
grid
.
store
.
getTotalCount
());
slider
.
setValue
(
grid
.
nRows
);
},
/**
* Update the slider/bottomToolBar parameters after a store write action.
* The latter create or destroy records in the store.
* The scope is the bottom grid.
*/
onWrite
:
function
()
{
"
use strict
"
;
var
bbar
,
grid
=
this
,
slider
;
bbar
=
grid
.
getBottomToolbar
();
bbar
.
pageSize
=
grid
.
store
.
getCount
();
slider
=
bbar
.
findByType
(
'
slider
'
)[
0
];
slider
.
setMaxValue
(
grid
.
store
.
getTotalCount
());
slider
.
setValue
(
grid
.
store
.
getCount
());
}
});
\ No newline at end of file
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