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
c2db1d36
Commit
c2db1d36
authored
14 years ago
by
Renaud Le Gac
Browse files
Options
Downloads
Patches
Plain Diff
Deploy the tool customize_grid_with_template_column in the configuration service.
parent
39d7f0e9
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
modules/plugin_dbui/cfgsvc.py
+54
-27
54 additions, 27 deletions
modules/plugin_dbui/cfgsvc.py
with
54 additions
and
27 deletions
modules/plugin_dbui/cfgsvc.py
+
54
−
27
View file @
c2db1d36
...
...
@@ -42,41 +42,68 @@ class CfgSvc(object):
setattr
(
self
,
'
_%s
'
%
key
,
pluginManager
.
dbui
[
key
])
def
_getColumn
sModel
(
self
,
tablename
):
"""
Generat
e column
s
model
required by the gridPanel widget.
The method return a lis
t.
def
_getColumn
(
self
,
tablename
,
fieldname
):
"""
Return a dictionary with th
e column model
required by the gridPanel widge
t.
"""
li
=
[]
for
fieldname
in
self
.
_db
[
tablename
].
fields
:
col
=
{}
field
=
self
.
_db
[
tablename
][
fieldname
]
col
=
{}
field
=
self
.
_db
[
tablename
][
fieldname
]
# column header
col
[
"
header
"
]
=
str
(
self
.
_translate
(
field
.
label
))
# replace foreign key by the pointing column
if
self
.
_is_foreign_field
(
tablename
,
fieldname
):
k_tablename
,
k_fieldname
,
k_key
=
\
self
.
_get_foreign_data
(
tablename
,
fieldname
)
col
[
"
dataIndex
"
]
=
encode_field
(
k_tablename
,
k_fieldname
)
# column header
col
[
"
header
"
]
=
str
(
self
.
_translate
(
field
.
label
))
# replace foreign key by the pointing column
if
self
.
_is_foreign_field
(
tablename
,
fieldname
):
# standard column
else
:
col
[
"
dataIndex
"
]
=
encode_field
(
tablename
,
fieldname
)
col
[
"
sortable
"
]
=
True
k_tablename
,
k_fieldname
,
k_key
=
\
self
.
_get_foreign_data
(
tablename
,
fieldname
)
col
[
"
dataIndex
"
]
=
encode_field
(
k_tablename
,
k_fieldname
)
# standard column
else
:
col
[
"
dataIndex
"
]
=
encode_field
(
tablename
,
fieldname
)
# hide the primary key
# and field which are not readable and not writable
if
fieldname
==
"
id
"
or
((
not
field
.
readable
)
and
(
not
field
.
writable
)):
col
[
"
sortable
"
]
=
True
# hide the primary key
# and field which are not readable and not writable
if
fieldname
==
"
id
"
or
((
not
field
.
readable
)
and
(
not
field
.
writable
)):
col
[
"
hidden
"
]
=
True
# Hide fields request customizing the grid
if
tablename
in
self
.
_hidden_columns
:
if
fieldname
in
self
.
_hidden_columns
[
tablename
]:
col
[
"
hidden
"
]
=
True
return
col
li
.
append
(
col
)
def
_getColumnsModel
(
self
,
tablename
):
"""
Return the columns model required by the gridPanel widget
handling customize columns.
"""
li
=
[]
# standard column
for
fieldname
in
self
.
_db
[
tablename
].
fields
:
li
.
append
(
self
.
_getColumn
(
tablename
,
fieldname
))
# template column
if
tablename
in
self
.
_template_columns
:
for
el
in
self
.
_template_columnd
[
tablename
]:
data
=
self
.
_template_columns
[
tablename
]
col
=
{
'
xtype
'
:
'
templatecolumn
'
,
'
header
'
:
data
.
header
,
'
tpl
'
:
data
.
tpl
,
'
sortable
'
:
True
}
li
.
insert
(
data
.
ipos
,
col
)
return
li
...
...
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