Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aggrid
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
aggrid
Commits
a24fa458
Commit
a24fa458
authored
Nov 17, 2023
by
Mike Feranda
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3402526
: Improve valueSend and change JS to allow look-ups
parent
521ddb78
Branches
Branches containing commit
Tags
8.x-1.0-rc11
Tags containing commit
1 merge request
!10
Update aggrid.widget.js
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/aggrid.widget.js
+50
-23
50 additions, 23 deletions
js/aggrid.widget.js
with
50 additions
and
23 deletions
js/aggrid.widget.js
+
50
−
23
View file @
a24fa458
/**
* Behavior for 'aggrid_widget_type' widget.
*/
(
function
(
$
,
Drupal
,
drupalSettings
,
once
)
{
var
aggrid
=
(
function
(
me
,
$
,
Drupal
,
drupalSettings
,
once
)
{
me
.
name
=
"
aggrid
"
;
'
use strict
'
;
var
aggridFieldName
=
[];
var
aggridDataEdit
=
[];
...
...
@@ -849,16 +850,18 @@
valueGot
=
eval
(
valueGetterItems
);
// Update the cell value.
if
(
gridOptions
[
item
].
rowData
[
params
.
node
.
id
][
params
.
column
.
colId
]
!=
valueGot
)
{
gridOptions
[
item
].
rowData
[
params
.
node
.
id
][
params
.
column
.
colId
]
=
valueGot
;
// If good and needs to be sent, send it.
valueSendFunc
(
params
,
valueGot
);
makeJson
(
item
);
// Make sure the rowData output is updated.
// Return it
return
valueGot
;
}
else
{
}
// else, just return the current value.
return
params
.
data
[
params
.
column
.
colId
];
}
}
function
valueParserFunc
(
params
)
{
let
ptName
;
...
...
@@ -1079,7 +1082,6 @@
// Used with valueSend JSON item to send values to another aggrid on the same node.
function
valueSendFunc
(
params
,
cellValue
)
{
let
valueSendItems
;
let
valueSet
;
// Auto value change when needed.
let
rscParamsRowId
;
let
rscParamsColDefField
;
...
...
@@ -1111,27 +1113,49 @@
// Look up the other grid and assign the variables.
let
t
=
$
(
'
div[data-aggrid-id="
'
+
value
[
'
aggrid_id
'
]
+
'
"]
'
).
attr
(
'
id
'
);
let
i
=
(
value
[
'
id
'
]
==
'
params.node.id
'
)
?
params
.
node
.
id
:
value
[
'
id
'
];
let
f
=
(
value
[
'
field
'
]
==
'
[this]
'
)
?
params
.
column
.
colId
:
value
[
'
field
'
];
let
f
=
(
value
[
'
field
'
]
==
'
[this]
'
)
?
params
.
column
.
colId
:
value
[
'
field
'
];
let
g
=
gridOptions
[
t
];
// Check if gridOption exists.
// @todo need to add proper error messages.
// Check if gridOption exists.F
if
(
typeof
g
!==
'
undefined
'
)
{
let
rowNode
=
g
.
api
.
getRowNode
(
i
);
// Check if rowNode exists.
if
(
typeof
rowNode
!==
'
undefined
'
)
{
if
(
f
!==
''
)
{
// Found... change the values and refresh.
rowNode
[
'
data
'
][
f
]
=
cellValue
;
g
.
api
.
refreshCells
();
rowNode
.
setDataValue
(
f
,
cellValue
);
return
true
;
}
else
{
console
.
log
(
Drupal
.
t
(
'
valueSend function on [
'
+
params
.
node
.
id
+
'
][
'
+
params
.
column
.
colId
+
'
] missing field name.
'
,
{},
{
context
:
'
aggrid error on valueSend
'
}
)
);
}
}
else
{
console
.
log
(
Drupal
.
t
(
'
valueSend function on [
'
+
params
.
node
.
id
+
'
][
'
+
params
.
column
.
colId
+
'
] row not found.
'
,
{},
{
context
:
'
aggrid error on valueSend
'
}
)
);
}
}
else
{
console
.
log
(
Drupal
.
t
(
'
valueSend function on [
'
+
params
.
node
.
id
+
'
][
'
+
params
.
column
.
colId
+
'
] missing row number.
'
,
{},
{
context
:
'
aggrid error on valueSend
'
}
)
);
}
});
return
true
;
}
else
{
// Issue
return
false
;
}
}
// #######
// ####### Context Menu Items
...
...
@@ -1500,7 +1524,7 @@
}
};
Drupal
.
behaviors
.
HtmlIntegration
=
{
Drupal
.
behaviors
.
aggrid
HtmlIntegration
=
{
attach
:
function
(
context
)
{
// Make sure to only run once per page for each item.
...
...
@@ -1577,4 +1601,7 @@
// No submit on aggrid with enter (allow enter cell for edit).
if
(
e
.
keyCode
===
13
)
{
e
.
preventDefault
();
}
});
})(
jQuery
,
Drupal
,
drupalSettings
,
once
);
me
.
gridOptions
=
gridOptions
;
return
me
;
})(
aggrid
||
{},
jQuery
,
Drupal
,
drupalSettings
,
once
);
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