Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Monster
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Javascript
Monster
Commits
8a4a2438
Verified
Commit
8a4a2438
authored
4 months ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
fix: check if element exists #278
parent
e12d1ad5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
development/templates/vite.config.mjs
+3
-2
3 additions, 2 deletions
development/templates/vite.config.mjs
source/components/datatable/datatable.mjs
+36
-28
36 additions, 28 deletions
source/components/datatable/datatable.mjs
with
39 additions
and
30 deletions
development/templates/vite.config.mjs
+
3
−
2
View file @
8a4a2438
...
...
@@ -93,8 +93,9 @@ export default defineConfig({
https
:
{
key
:
"
${LOCALHOST_CERTS_DIR}/localhost.alvine.dev.key
"
,
cert
:
"
${LOCALHOST_CERTS_DIR}/localhost.alvine.dev.crt
"
},
watch
:
{
ignored
:
[
'
**/node_modules/**
'
]
},
debug
:
true
,
proxy
:
{
...
...
This diff is collapsed.
Click to expand it.
source/components/datatable/datatable.mjs
+
36
−
28
View file @
8a4a2438
...
...
@@ -881,43 +881,51 @@ function initEventHandler() {
"
data-monster-role
"
,
"
select-row
"
,
);
if
(
element
)
{
const
key
=
element
.
parentNode
.
getAttribute
(
"
data-monster-insert-reference
"
,
);
const
row
=
self
.
getGridElements
(
`[data-monster-insert-reference="
${
key
}
"]`
,
);
const
index
=
key
.
split
(
"
-
"
).
pop
();
if
(
element
.
checked
)
{
row
.
forEach
((
col
)
=>
{
col
.
classList
.
add
(
"
selected
"
);
});
fireCustomEvent
(
self
,
"
monster-datatable-row-selected
"
,
{
index
:
index
,
});
}
else
{
row
.
forEach
((
col
)
=>
{
col
.
classList
.
remove
(
"
selected
"
);
});
fireCustomEvent
(
self
,
"
monster-datatable-row-deselected
"
,
{
index
:
index
,
});
}
if
(
!
element
)
{
return
;
}
const
key
=
element
.
parentNode
.
getAttribute
(
"
data-monster-insert-reference
"
,
);
const
row
=
self
.
getGridElements
(
`[data-monster-insert-reference="
${
key
}
"]`
,
);
fireCustomEvent
(
this
,
"
monster-datatable-selection-changed
"
,
{});
const
index
=
key
.
split
(
"
-
"
).
pop
();
if
(
element
.
checked
)
{
row
.
forEach
((
col
)
=>
{
col
.
classList
.
add
(
"
selected
"
);
});
fireCustomEvent
(
self
,
"
monster-datatable-row-selected
"
,
{
index
:
index
,
});
}
else
{
row
.
forEach
((
col
)
=>
{
col
.
classList
.
remove
(
"
selected
"
);
});
fireCustomEvent
(
self
,
"
monster-datatable-row-deselected
"
,
{
index
:
index
,
});
}
fireCustomEvent
(
this
,
"
monster-datatable-selection-changed
"
,
{});
const
rows
=
self
.
getGridElements
(
`[data-monster-role="select-row"]`
);
const
allSelected
=
Array
.
from
(
rows
).
every
((
row
)
=>
row
.
checked
);
const
selectAll
=
this
[
gridHeadersElementSymbol
].
querySelector
(
`[data-monster-role="select-all"]`
,
);
selectAll
.
checked
=
allSelected
;
if
(
selectAll
)
{
selectAll
.
checked
=
allSelected
;
}
};
this
[
gridElementSymbol
].
addEventListener
(
"
click
"
,
selectRowCallback
);
...
...
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