Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
13b610c1
Commit
13b610c1
authored
Dec 31, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Change] 仅点击checkbox选中
parent
7558c2b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
19 deletions
+26
-19
jumpserver.js
apps/static/js/jumpserver.js
+26
-19
No files found.
apps/static/js/jumpserver.js
View file @
13b610c1
...
...
@@ -250,12 +250,14 @@ jumpserver.initDataTable = function (options) {
// }
var
ele
=
options
.
ele
||
$
(
'.dataTable'
);
var
columnDefs
=
[
{
targets
:
0
,
orderable
:
false
,
createdCell
:
function
(
td
,
cellData
)
{
$
(
td
).
html
(
'<input type="checkbox" class="text-center ipt_check" id=99991937>'
.
replace
(
'99991937'
,
cellData
));
}},
{
targets
:
0
,
orderable
:
false
,
createdCell
:
function
(
td
,
cellData
)
{
$
(
td
).
html
(
'<input type="checkbox" class="text-center ipt_check" id=99991937>'
.
replace
(
'99991937'
,
cellData
));
}
},
// className: 'select-checkbox'
{
className
:
'text-center'
,
targets
:
'_all'
}
];
columnDefs
=
options
.
columnDefs
?
options
.
columnDefs
.
concat
(
columnDefs
)
:
columnDefs
;
...
...
@@ -263,7 +265,7 @@ jumpserver.initDataTable = function (options) {
pageLength
:
options
.
pageLength
||
15
,
dom
:
options
.
dom
||
'<"#uc.pull-left">flt<"row m-t"<"col-md-8"<"#op.col-md-6"><"col-md-6 text-center"i>><"col-md-4"p>>'
,
order
:
options
.
order
||
[],
select
:
options
.
select
||
'multi'
,
//
select: options.select || 'multi',
buttons
:
[],
columnDefs
:
columnDefs
,
ajax
:
{
...
...
@@ -271,6 +273,10 @@ jumpserver.initDataTable = function (options) {
dataSrc
:
""
},
columns
:
options
.
columns
||
[],
select
:
{
style
:
'multi'
,
selector
:
'td:first-child'
},
lengthMenu
:
[[
15
,
25
,
50
,
-
1
],
[
15
,
25
,
50
,
"All"
]]
});
table
.
on
(
'select'
,
function
(
e
,
dt
,
type
,
indexes
)
{
...
...
@@ -281,21 +287,22 @@ jumpserver.initDataTable = function (options) {
var
$node
=
table
[
type
](
indexes
).
nodes
().
to$
();
$node
.
find
(
'input.ipt_check'
).
prop
(
'checked'
,
false
);
jumpserver
.
selected
[
$node
.
find
(
'input.ipt_check'
).
prop
(
'id'
)]
=
false
}).
on
(
'draw'
,
function
(){
}).
on
(
'draw'
,
function
(){
$
(
'#op'
).
html
(
options
.
op_html
||
''
);
$
(
'#uc'
).
html
(
options
.
uc_html
||
''
);
});
$
(
'.ipt_check_all'
).
on
(
'click'
,
function
()
{
if
(
!
jumpserver
.
checked
)
{
$
(
this
).
closest
(
'table'
).
find
(
'.ipt_check'
).
prop
(
'checked'
,
true
);
jumpserver
.
checked
=
true
;
table
.
rows
().
select
();
}
else
{
$
(
this
).
closest
(
'table'
).
find
(
'.ipt_check'
).
prop
(
'checked'
,
false
);
jumpserver
.
checked
=
false
;
table
.
rows
().
deselect
();
}
});
//
$('.ipt_check_all').on('click', function() {
//
if (!jumpserver.checked) {
//
$(this).closest('table').find('.ipt_check').prop('checked', true);
//
jumpserver.checked = true;
//
table.rows().select();
//
} else {
//
$(this).closest('table').find('.ipt_check').prop('checked', false);
//
jumpserver.checked = false;
//
table.rows().deselect();
//
}
//
});
return
table
;
};
...
...
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