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
1c7cf6fb
Commit
1c7cf6fb
authored
11 years ago
by
LE GAC Renaud
Browse files
Options
Downloads
Patches
Plain Diff
ExtJS 4.2: Polish the grid reset.
parent
4d2db2a8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
static/plugin_dbui/src/grid.js
+0
-2
0 additions, 2 deletions
static/plugin_dbui/src/grid.js
static/plugin_dbui/src/gridfilter.js
+29
-54
29 additions, 54 deletions
static/plugin_dbui/src/gridfilter.js
with
29 additions
and
56 deletions
static/plugin_dbui/src/grid.js
+
0
−
2
View file @
1c7cf6fb
...
...
@@ -67,8 +67,6 @@ Ext.define('App.grid.Grid', {
/**
* Reset the grid by removing filtering conditions
* and by loading fresh data when the store is buffered.
* TODO: duplicate with gridfilter.onReset. Improve it.
*
*/
reset
:
function
()
{
...
...
This diff is collapsed.
Click to expand it.
static/plugin_dbui/src/gridfilter.js
+
29
−
54
View file @
1c7cf6fb
...
...
@@ -13,8 +13,8 @@ Ext.define('App.grid.GridFilter', {
// this is used when running with a buffered store.
filterConditions
:
{},
// Private reference to the grid
store
store
:
null
,
// Private reference to the grid
grid
:
null
,
// Predefined setting
//
...
...
@@ -91,7 +91,7 @@ Ext.define('App.grid.GridFilter', {
},
this
);
// remove private reference
this
.
store
=
null
;
this
.
grid
=
null
;
// base class
this
.
callParent
(
arguments
);
...
...
@@ -105,14 +105,14 @@ Ext.define('App.grid.GridFilter', {
"
use strict
"
;
var
buttons
=
grid
.
query
(
'
button
'
),
r
eset
;
buttonR
eset
;
this
.
store
=
grid
.
getStore
()
;
this
.
grid
=
grid
;
// clicking the reset button of the grid reset the filter's fields.
if
(
buttons
&&
buttons
[
0
].
menu
)
{
r
eset
=
buttons
[
0
].
menu
.
getComponent
(
'
buttonReset
'
);
r
eset
.
on
(
'
click
'
,
this
.
r
eset
,
this
);
buttonR
eset
=
buttons
[
0
].
menu
.
getComponent
(
'
buttonReset
'
);
buttonR
eset
.
on
(
'
click
'
,
this
.
onR
eset
,
this
);
}
},
...
...
@@ -171,13 +171,14 @@ Ext.define('App.grid.GridFilter', {
"
use strict
"
;
var
filter
=
this
.
store
.
filters
.
getByKey
(
field
.
name
),
var
store
=
this
.
grid
.
getStore
(),
filter
=
store
.
filters
.
getByKey
(
field
.
name
),
value
=
field
.
getValue
();
// Clear an existing filter
if
(
filter
&&
field
.
filterType
===
'
string
'
&&
value
===
""
)
{
this
.
store
.
removeFilter
(
filter
);
store
.
removeFilter
(
filter
);
return
;
}
...
...
@@ -191,13 +192,13 @@ Ext.define('App.grid.GridFilter', {
break
;
}
filter
.
setValue
(
value
);
this
.
store
.
filter
();
store
.
filter
();
return
;
}
// create a new filter
filter
=
this
.
createLocalFilter
(
field
);
this
.
store
.
addFilter
(
filter
);
store
.
addFilter
(
filter
);
},
/**
...
...
@@ -211,7 +212,7 @@ Ext.define('App.grid.GridFilter', {
"
use strict
"
;
if
(
this
.
s
tore
.
buffered
)
{
if
(
this
.
grid
.
getS
tore
()
.
buffered
)
{
this
.
remoteFiltering
(
field
);
}
else
{
...
...
@@ -226,19 +227,15 @@ Ext.define('App.grid.GridFilter', {
"
use strict
"
;
// reset field values and filter conditions
this
.
reset
();
if
(
this
.
store
.
buffered
)
{
this
.
store
.
restoreWhere
();
this
.
store
.
data
.
clear
(
true
);
this
.
store
.
loadPage
(
1
);
}
else
{
// reset the field values
this
.
items
.
each
(
function
(
item
)
{
if
(
item
.
isFormField
)
{
item
.
reset
();
}
});
this
.
store
.
filter
();
}
// reset the grid
this
.
grid
.
reset
();
},
/**
...
...
@@ -254,6 +251,7 @@ Ext.define('App.grid.GridFilter', {
var
conditions
=
[],
i
,
k
,
store
=
this
.
grid
.
getStore
(),
value
,
where
;
...
...
@@ -279,9 +277,9 @@ Ext.define('App.grid.GridFilter', {
}
// build the complete where clause
if
(
this
.
store
.
initialWhere
)
{
for
(
i
=
0
;
i
<
this
.
store
.
initialWhere
.
length
;
i
+=
1
)
{
conditions
.
push
(
this
.
store
.
initialWhere
[
i
]);
if
(
store
.
initialWhere
)
{
for
(
i
=
0
;
i
<
store
.
initialWhere
.
length
;
i
+=
1
)
{
conditions
.
push
(
store
.
initialWhere
[
i
]);
}
}
...
...
@@ -293,11 +291,11 @@ Ext.define('App.grid.GridFilter', {
// push new condition in the where clause of the store
if
(
conditions
.
length
)
{
this
.
store
.
extraParams
.
where
=
conditions
;
store
.
extraParams
.
where
=
conditions
;
// go back to the initial where setting when conditions are empty
}
else
{
this
.
store
.
restoreWhere
();
store
.
restoreWhere
();
}
// load the data
...
...
@@ -306,30 +304,7 @@ Ext.define('App.grid.GridFilter', {
// Some records are not over written and correspond to
// the previous filtering. Clearing the buffer solve this issue.
// Copy from the method Ext.data.Store.reload
this
.
store
.
data
.
clear
(
true
);
this
.
store
.
loadPage
(
1
);
},
/**
* Reset the filter conditions
*/
reset
:
function
()
{
"
use strict
"
;
// reset the field values
this
.
items
.
each
(
function
(
item
)
{
if
(
item
.
isFormField
)
{
item
.
reset
();
}
});
// reset filter conditions
if
(
this
.
store
.
buffered
)
{
this
.
filterConditions
=
{};
}
else
{
this
.
store
.
clearFilter
();
}
store
.
data
.
clear
(
true
);
store
.
loadPage
(
1
);
}
});
\ 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