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
887ef28a
Commit
887ef28a
authored
10 years ago
by
LE GAC Renaud
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in form panel related to container fields.
parent
bc3d4aec
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/form/Panel.js
+40
-23
40 additions, 23 deletions
static/plugin_dbui/src/form/Panel.js
with
40 additions
and
23 deletions
static/plugin_dbui/src/form/Panel.js
+
40
−
23
View file @
887ef28a
...
...
@@ -33,6 +33,7 @@ Ext.define('App.form.Panel', {
'
App.form.field.Dict
'
,
'
App.form.field.DictMultiDefault
'
,
'
App.form.field.List
'
,
'
App.form.field.TextPicker
'
,
'
Ext.form.field.Date
'
,
'
Ext.form.field.HtmlEditor
'
],
...
...
@@ -361,37 +362,53 @@ Ext.define('App.form.Panel', {
"
use strict
"
;
var
combo
,
field
,
fields
=
[],
i
,
items
,
containers
,
fields
,
rec
,
value
;
function
pushToFields
(
key
,
value
)
{
fields
.
push
(
value
);
}
// get the list of dirty fields
items
=
this
.
getForm
().
getFields
();
items
.
each
(
function
(
item
,
index
,
len
)
{
if
(
item
.
getXType
()
!==
'
compositefield
'
)
{
fields
.
push
(
item
);
}
});
// include dirty fields embedded in composite fields
items
.
each
(
function
(
item
,
index
,
len
)
{
if
(
item
.
getXType
()
===
'
compositefield
'
)
{
item
.
items
.
eachKey
(
pushToFields
);
//
// get the list of basic fields:
// those at the first level and those encapsulated in fieldset
//
// WARNING: do not use query(field) since it find all fields
// including those encapsulated in complexe field container
// which encapsulated grid with cell editing...
//
fields
=
this
.
query
(
'
> field
'
);
fields
=
Ext
.
Array
.
merge
(
fields
,
this
.
query
(
'
fieldset > field
'
));
// get the list of field container:
// those at the first level and those encapsulated in fieldset
containers
=
this
.
query
(
'
> fieldcontainer
'
);
containers
=
Ext
.
Array
.
merge
(
containers
,
this
.
query
(
'
fieldset > fieldcontainer
'
));
// container handles two type of object:
// - composite field merging several standard field
// - single field encapsulating complex widget grid with cell editing.
//
// the extraction the sub field structure depends on the type
Ext
.
Array
.
each
(
containers
,
function
(
el
)
{
// standard field container merging basic fields:
// retrieve all basic fields
if
(
el
.
getXType
()
===
'
fieldcontainer
'
)
{
Ext
.
Array
.
each
(
el
.
query
(
'
> field
'
),
function
(
field
)
{
fields
.
push
(
field
);
});
// field container encapsulating complex object:
// treat it as a single field
}
else
{
fields
.
push
(
el
);
}
});
// update the record
// take care of special treatment required by date and combobox
for
(
i
=
0
;
i
<
fields
.
length
;
i
+=
1
)
{
Ext
.
Array
.
each
(
fields
,
function
(
field
)
{
field
=
fields
[
i
];
value
=
field
.
getValue
();
switch
(
field
.
getXType
())
{
...
...
@@ -424,6 +441,6 @@ Ext.define('App.form.Panel', {
}
record
.
set
(
field
.
getName
(),
value
);
}
}
);
}
});
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