TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ayesha Fathima
NA
184
30.1k
Check all visible rows in data table
Feb 20 2018 12:17 AM
I have Datatable i gave checkboxes to al rows,but i want to add "check all" functionality in table to the visible rows in table.Means if iam showing 10 records out of 100 recrds,i need to check those 10 records at a time in time.
I tried this script by searching in google,but it is not working properly.Can you please give anyother way
<div
class
=
"panel-body"
>
<table id=
"Getmaildetailstable"
class
=
"table table-striped display"
width=
"100%"
>
<thead>
<tr>
<th><input name=
"select_all"
value=
"1"
id=
"Getmaildetailstable-select-all"
type=
"checkbox"
/></th>
<th>Starredflag</th>
<th>Importantflag</th>
<th>Mailid</th>
<th>Mailbox</th>
<th>LogicalID</th>
<th>Starred</th>
<th>Important</th>
<th>Subject</th>
<th>attachments</th>
<th>mailsize</th>
<th data-date-format=
"yyyymmdd"
>Created On</th>
<th data-date-format=
"yyyymmdd"
>Received On</th>
<th>Difference value</th>
<th>From</th>
<th>Due flag op</th>
<th>To</th>
<th>Read status</th>
<th>Incident_no</th>
<th>classification</th>
<th>Overdue</th>
<th>Attachments</th>
</tr>
</thead>
</table>
</div>
<script>
getmailsdataObjects();
Getmaildetailstable = $(
'#Getmaildetailstable'
).DataTable({
columns: [{
orderable:
false
,
className:
'select-checkbox'
,
defaultContent:
""
,
targets: 0,
visible:
true
,
'render'
:
function
(data, type, full, meta){
return
'<input type="checkbox" name="id[]" value="'
+ $(
'<div/>'
).text(data).html() +
'">'
;
}
}, {
data:
"STARRED_FLAG"
,
defaultContent:
""
,
targets: 1,
visible:
false
},
{
data:
"IMPORTANT_FLAG"
,
defaultContent:
""
,
targets: 2,
visible:
false
}, {
data:
"EMAIL_ID"
,
defaultContent:
""
,
targets: 3,
visible:
false
}, {
data:
"EMAILBOX"
,
defaultContent:
""
,
targets: 4,
visible:
false
}, {
data:
"LOGICAL_ID"
,
defaultContent:
""
,
targets: 5,
visible:
false
}, {
data:
"image"
,render: getStarredflag,
defaultContent:
""
,
targets: 6,
visible:
true
},{
data:
"image"
,render: getImportantflag,
defaultContent:
""
,
targets: 7,
visible:
true
},{
data:
"SUBJECT"
,
defaultContent:
""
,
targets: 8,
"render"
:
function
( data, type, row ) {
return
'<a href="javascript:void(0)" onclick="openmaildetailsfunction()">'
+ data +
'</a>'
;
},
visible:
true
},{
data:
"attachments"
,
defaultContent:
""
,
targets: 9,
visible:
false
},{
data:
"MAIL_SIZE"
,
defaultContent:
""
,
targets: 10,
visible:
false
},{
data:
"CREATE_DATE"
,
defaultContent:
""
,
targets: 11,
visible:
true
},{
data:
"RECEIVE_DATE"
,
defaultContent:
""
,
targets: 12,
visible:
false
},{
data:
"flag"
,
defaultContent:
""
,
targets: 13,
visible:
false
},{
data:
"FROM_ADDRESS"
,
defaultContent:
""
,
targets: 14,
visible:
true
},{
data:
"flagday"
,
defaultContent:
""
,
targets: 15,
visible:
false
},{
data:
"TO_ADDRESS"
,
defaultContent:
""
,
targets: 16,
visible:
true
},{
data:
"READ_STATUS"
,
defaultContent:
""
,
targets: 17,
visible:
false
},{
data:
"INCIDENT_NO"
,
defaultContent:
""
,
targets: 18,
visible:
false
},{
data:
"CLASSIFICATION_TYPE"
,
defaultContent:
""
,
targets: 19,
visible:
false
},{
data:
"overdue"
,
defaultContent:
""
,
targets: 20,
visible:
true
},{
data:
"image"
,render: getImg,
defaultContent:
""
,
targets: 21,
visible:
true
}],
select: {
style:
'multi'
,
selector:
'td:first-child'
},
order: [
[2,
'asc'
]
],
"searching"
:
false
,
"lengthChange"
:
true
});
},
error:
function
(errorObj){
console.log(errorObj);
$.notify(
"Error occurred in getting the Mailbox List. Please contact administrator."
);
}
});
// Handle click on "Select all" control
$(
'#Getmaildetailstable-select-all'
).on(
'click'
,
function
(){
// Get all rows with search applied
var
rows = Getmaildetailstable.rows({
'search'
:
'applied'
}).nodes();
// Check/uncheck checkboxes for all rows in the table
$(
'input[type="checkbox"]'
, rows).prop(
'checked'
,
this
.checked);
});
</script>
Reply
Answers (
1
)
Draw JointJs UML
What are the open source tools for Automation Testing ?