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
3d4b759a
Commit
3d4b759a
authored
14 years ago
by
Renaud Le Gac
Browse files
Options
Downloads
Patches
Plain Diff
Add the handling of combobox.
Paging is still missing.
parent
9492ba38
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/lib/appgridfilter.js
+30
-19
30 additions, 19 deletions
static/plugin_dbui/lib/appgridfilter.js
with
30 additions
and
19 deletions
static/plugin_dbui/lib/appgridfilter.js
+
30
−
19
View file @
3d4b759a
...
...
@@ -33,7 +33,6 @@ App.grid.GridFilter = Ext.extend(Object, {
* Plugin initialization
*/
init
:
function
(
grid
){
console
.
debug
(
'
start grid filter plugin
'
);
// link the grid store
this
.
store
=
grid
.
getStore
();
...
...
@@ -49,38 +48,49 @@ App.grid.GridFilter = Ext.extend(Object, {
for
(
var
i
=
0
;
i
<
fields
.
length
;
i
++
){
field
=
fields
[
i
];
// catch the enter for non combobox field
if
(
fields
.
xtype
!=
'
xcombobox
'
){
// catch a change of value for combo box
if
(
field
.
xtype
==
'
xcombobox
'
)
field
.
on
(
'
select
'
,
this
.
onSelect
,
this
);
// catch the key pressed enter for other fields
else
field
.
on
(
'
specialkey
'
,
this
.
onSpecialKey
,
this
);
}
}
},
/**
* Handler to catch a new selection in combobox
*/
onSelect
:
function
(
combo
,
record
,
index
){
this
.
filter
(
combo
);
},
/**
* Handler to catch the ENTER
* @param {Object} field
* @param {Object} e
*/
onSpecialKey
:
function
(
field
,
e
){
if
(
e
.
getKey
()
==
e
.
ENTER
)
{
var
value
=
field
.
getValue
();
var
where
=
field
.
name
+
"
"
+
field
.
filterOperator
+
"
'
"
+
value
+
"
'
"
;
if
(
value
==
''
)
delete
this
.
filterConditions
[
field
.
name
];
else
this
.
filterConditions
[
field
.
name
]
=
where
;
this
.
filter
();
}
if
(
e
.
getKey
()
==
e
.
ENTER
)
this
.
filter
(
field
);
},
/**
* Filter the data
* @param {Ext.form.Field}
*/
filter
:
function
(){
console
.
debug
(
'
filter the data
'
);
filter
:
function
(
field
){
// get the field value and update the condition dictionary
var
value
=
field
.
getValue
();
var
where
=
field
.
name
+
"
"
+
field
.
filterOperator
+
"
'
"
+
value
+
"
'
"
;
if
(
value
==
''
)
delete
this
.
filterConditions
[
field
.
name
];
else
this
.
filterConditions
[
field
.
name
]
=
where
;
// build the complete where clause
var
conditions
=
[];
for
(
var
i
=
0
;
i
<
this
.
initialFilterConditions
.
length
;
i
++
){
conditions
.
push
(
this
.
initialFilterConditions
[
i
]);
...
...
@@ -89,7 +99,8 @@ App.grid.GridFilter = Ext.extend(Object, {
for
(
k
in
this
.
filterConditions
){
conditions
.
push
(
this
.
filterConditions
[
k
]);
}
// update the store
this
.
store
.
baseParams
.
where
=
conditions
;
this
.
store
.
load
();
}
...
...
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