Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
tev
plugin_event
Commits
bb7199bc
Commit
bb7199bc
authored
Apr 19, 2017
by
LE GAC Renaud
Browse files
Update UserDataMultiDefault in order to simplify the method setValue and to fix a bug.
parent
e1f3e845
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
30 deletions
+29
-30
static/plugin_event/src/form/field/UserDataMultiDefault.js
static/plugin_event/src/form/field/UserDataMultiDefault.js
+29
-30
No files found.
static/plugin_event/src/form/field/UserDataMultiDefault.js
View file @
bb7199bc
...
...
@@ -238,19 +238,27 @@ Ext.define('Event.form.field.UserDataMultiDefault', {
var
me
=
this
,
combo
=
me
.
combo
||
null
,
previousEvent
=
me
.
lastEvent
,
undef
=
me
.
trUndefined
,
cfg
,
form
,
formRecord
,
rawValue
,
record
;
form
=
me
.
up
(
'
xform, form
'
).
getForm
(),
cfg
,
formRecord
,
rawValue
,
record
;
// link me to the ComboBox
// The comboBox field is identidied by its name, e.g HistororyId_events
// is the form ready
if
(
!
form
)
{
return
;
}
// linked the ComboBox
// It is identified by its name, e.g HistororyId_events
if
(
!
combo
)
{
form
=
me
.
up
(
'
xform, form
'
).
getForm
(
);
if
(
!
form
)
{
me
.
combo
=
form
.
findField
(
me
.
formFieldIdEvent
);
if
(
!
combo
)
{
return
;
}
me
.
combo
=
form
.
findField
(
me
.
formFieldIdEvent
);
}
// check if the the select handler activated for the ComboBox
if
(
!
combo
.
hasListener
(
"
select
"
))
{
me
.
combo
.
on
(
'
select
'
,
me
.
onComboBoxSelect
,
me
);
return
;
}
// protection
...
...
@@ -260,31 +268,22 @@ Ext.define('Event.form.field.UserDataMultiDefault', {
return
;
}
formRecord
=
me
.
up
(
'
xform, form
'
).
getForm
().
getRecord
();
// rather complicated logic to find the correct grid configuration
// NOTE ExtJS 6.2
//
// NOTE ExtJS 6
// The ComboBox behave strangely in that configuration
// The method ComboBox.getValue() always return 1
// The property value and rawValue refer to was have been select previously
// Therefore a complexe logic is required to solve all case
// In order to retrieve the configuration for the event, it should be
// enough to extract the event selected in the ComboBox. However, the
// ComboBox behave strangely, since the method ComboBox.getValue()
// always return 1.
//
// In order to fix this issue, we get the full record loaded in the
// form, instead, and extract the selected event.
//
if
((
previousEvent
===
undef
&&
rawValue
===
undef
)
||
formRecord
===
undefined
)
{
me
.
lastKey
=
1
;
value
=
{};
}
else
if
(
previousEvent
!==
undefined
&&
rawValue
===
undef
)
{
me
.
lastKey
=
1
;
value
=
{};
}
else
if
(
previousEvent
===
rawValue
)
{
me
.
lastKey
=
formRecord
.
get
(
me
.
formFieldIdEvent
);
}
else
if
(
previousEvent
===
undefined
&&
formRecord
!==
null
)
{
me
.
lastKey
=
formRecord
.
get
(
me
.
formFieldIdEvent
);
// get the data load in the form
formRecord
=
form
.
getRecord
(
);
}
else
if
(
previousEvent
!==
undefined
&&
rawValue
!==
undefined
)
{
// get the selected event and retrieve its configuration
if
(
formRecord
)
{
me
.
lastKey
=
formRecord
.
get
(
me
.
formFieldIdEvent
);
}
else
{
...
...
@@ -295,7 +294,7 @@ Ext.define('Event.form.field.UserDataMultiDefault', {
record
=
me
.
store
.
findRecord
(
me
.
dictFieldIdEvent
,
me
.
lastKey
);
me
.
lastEvent
=
record
.
get
(
me
.
dictFieldEvent
);
//
build
the configuration
o
f the Ext.grid.property.Grid
//
get
the configuration f
or
the Ext.grid.property.Grid
cfg
=
me
.
buildSourceConfig
(
record
);
// fill the property grid
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment