Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
f2e25f60
Commit
f2e25f60
authored
12 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Issue
#1880798
by droplet: Fixed tableselect.js performances.
parent
fbfaa3a4
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/misc/tableselect.js
+5
-5
5 additions, 5 deletions
core/misc/tableselect.js
with
5 additions
and
5 deletions
core/misc/tableselect.js
+
5
−
5
View file @
f2e25f60
...
@@ -11,7 +11,7 @@ Drupal.behaviors.tableSelect = {
...
@@ -11,7 +11,7 @@ Drupal.behaviors.tableSelect = {
Drupal
.
tableSelect
=
function
()
{
Drupal
.
tableSelect
=
function
()
{
// Do not add a "Select all" checkbox if there are no rows with checkboxes in the table
// Do not add a "Select all" checkbox if there are no rows with checkboxes in the table
if
(
$
(
this
).
find
(
'
td input
:
checkbox
'
).
length
===
0
)
{
if
(
$
(
this
).
find
(
'
td input
[type="
checkbox
"]
'
).
length
===
0
)
{
return
;
return
;
}
}
...
@@ -21,7 +21,7 @@ Drupal.tableSelect = function () {
...
@@ -21,7 +21,7 @@ Drupal.tableSelect = function () {
var
strings
=
{
'
selectAll
'
:
Drupal
.
t
(
'
Select all rows in this table
'
),
'
selectNone
'
:
Drupal
.
t
(
'
Deselect all rows in this table
'
)
};
var
strings
=
{
'
selectAll
'
:
Drupal
.
t
(
'
Select all rows in this table
'
),
'
selectNone
'
:
Drupal
.
t
(
'
Deselect all rows in this table
'
)
};
var
updateSelectAll
=
function
(
state
)
{
var
updateSelectAll
=
function
(
state
)
{
// Update table's select-all checkbox (and sticky header's if available).
// Update table's select-all checkbox (and sticky header's if available).
$table
.
prev
(
'
table.sticky-header
'
).
andSelf
().
find
(
'
th.select-all input
:
checkbox
'
).
each
(
function
()
{
$table
.
prev
(
'
table.sticky-header
'
).
andSelf
().
find
(
'
th.select-all input
[type="
checkbox
"]
'
).
each
(
function
()
{
$
(
this
).
attr
(
'
title
'
,
state
?
strings
.
selectNone
:
strings
.
selectAll
);
$
(
this
).
attr
(
'
title
'
,
state
?
strings
.
selectNone
:
strings
.
selectAll
);
this
.
checked
=
state
;
this
.
checked
=
state
;
});
});
...
@@ -29,7 +29,7 @@ Drupal.tableSelect = function () {
...
@@ -29,7 +29,7 @@ Drupal.tableSelect = function () {
// Find all <th> with class select-all, and insert the check all checkbox.
// Find all <th> with class select-all, and insert the check all checkbox.
$table
.
find
(
'
th.select-all
'
).
prepend
(
$
(
'
<input type="checkbox" class="form-checkbox" />
'
).
attr
(
'
title
'
,
strings
.
selectAll
)).
click
(
function
(
event
)
{
$table
.
find
(
'
th.select-all
'
).
prepend
(
$
(
'
<input type="checkbox" class="form-checkbox" />
'
).
attr
(
'
title
'
,
strings
.
selectAll
)).
click
(
function
(
event
)
{
if
(
$
(
event
.
target
).
is
(
'
input
:
checkbox
'
))
{
if
(
$
(
event
.
target
).
is
(
'
input
[type="
checkbox
"]
'
))
{
// Loop through all checkboxes and set their state to the select all checkbox' state.
// Loop through all checkboxes and set their state to the select all checkbox' state.
checkboxes
.
each
(
function
()
{
checkboxes
.
each
(
function
()
{
this
.
checked
=
event
.
target
.
checked
;
this
.
checked
=
event
.
target
.
checked
;
...
@@ -42,7 +42,7 @@ Drupal.tableSelect = function () {
...
@@ -42,7 +42,7 @@ Drupal.tableSelect = function () {
});
});
// For each of the checkboxes within the table that are not disabled.
// For each of the checkboxes within the table that are not disabled.
checkboxes
=
$table
.
find
(
'
td input
:
checkbox:enabled
'
).
click
(
function
(
e
)
{
checkboxes
=
$table
.
find
(
'
td input
[type="
checkbox
"]
:enabled
'
).
click
(
function
(
e
)
{
// Either add or remove the selected class based on the state of the check all checkbox.
// Either add or remove the selected class based on the state of the check all checkbox.
$
(
this
).
closest
(
'
tr
'
).
toggleClass
(
'
selected
'
,
this
.
checked
);
$
(
this
).
closest
(
'
tr
'
).
toggleClass
(
'
selected
'
,
this
.
checked
);
...
@@ -75,7 +75,7 @@ Drupal.tableSelectRange = function (from, to, state) {
...
@@ -75,7 +75,7 @@ Drupal.tableSelectRange = function (from, to, state) {
$i
=
$
(
i
);
$i
=
$
(
i
);
// Either add or remove the selected class based on the state of the target checkbox.
// Either add or remove the selected class based on the state of the target checkbox.
$i
.
toggleClass
(
'
selected
'
,
state
);
$i
.
toggleClass
(
'
selected
'
,
state
);
$i
.
find
(
'
input
:
checkbox
'
).
attr
(
'
checked
'
,
state
);
$i
.
find
(
'
input
[type="
checkbox
"]
'
).
attr
(
'
checked
'
,
state
);
if
(
to
.
nodeType
)
{
if
(
to
.
nodeType
)
{
// If we are at the end of the range, stop.
// If we are at the end of the range, stop.
...
...
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