how to diselect row after alert?

how to diselect row after alert?

mark_28mark_28 Posts: 1Questions: 1Answers: 0
edited November 2020 in Free community support

ill try to diselect row after alert but when message show it doesnt work please help

$(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("test");
                    isChecked = false;
                 }

            }
            else {
                 var i = idsExcess.indexOf(id);
                idsExcess.splice(i, 1);
            }
        }

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    It's not showing how/when addavailable() would be called. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.