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
Denmark Puso
NA
232
50.7k
how to diselect checkbox after alert?
Nov 27 2020 2:43 AM
im using datatable i need to limit the selected row. how can i diselect my last selected after alert?
$(
function
() {
var
TableExcess = $(
'#PaymentExcess'
).DataTable({
"scrollY"
:
'50vh'
,
"scrollCollapse"
:
true
,
"paging"
:
false
,
"destroy"
:
true
,
"ajax"
:
"@Url.Action("
GetPaymentExcess
", "
payable
")"
,
"columns"
: [
{
"render"
:
function
(data, type, full, meta) {
return
"<input type='checkbox' class='checkbox' onclick='addavailable("
+ full.Id +
", "
+ full.AvailableAmount +
", \""
+ full.AccountName +
"\", this.checked)'>"
}
},
{
"data"
:
"Id"
},
{
"data"
:
"AccountName"
},
{
"data"
:
"PaidAmount"
},
{
"data"
:
"AvailableAmount"
},
]
});
});
var
idsExcess = [];
function
addavailable(id, amount, acctname, isChecked)
{
if
(isChecked) {
//condition
idsExcess.push(id);
if
(idsExcess.lenght > 2) {
var
i = idsExcess.indexOf(id);
idsExcess.splice(i, 1);
alert(
"diselect last selected"
);
isChecked =
false
;
}
}
else
{
var
i = idsExcess.indexOf(id);
idsExcess.splice(i, 1);
}
}
Reply
Answers (
2
)
Jquery dataTable computed column.
add to list (ul,li) after writing on input and pressing enter.