cancel checkbox change

cancel checkbox change

montoyammontoyam Posts: 568Questions: 136Answers: 5
edited July 2021 in Editor

I am using inline editor as in this example:

However, when a checkbox is initially checked, I am using a modal box to confirm the user really wants it un-checked. The code works as far as cancelling the editing of the record, but, the checkbox continues to be unchecked until the dataTable is refreshed. I tried e.preventDefault() but that doesn't seem to work.

any ideas??

        $('#SDPlus_BillableItems').on('change', 'input.editor-active', function (e) {
            var tr = $(this).closest('tr');
            var row = BillableItemsTable.row(tr);
            thisRow = this;
            selectedpkID =;
            approvedBy =;
            if (approvedBy != null) {
                $('#alertModal').modal('show');  //only update if user confirms
                return false;
            } else {

        $('#alertModal').on('click', '#modalButtonConfirm', function (e) {

        function updateRow() {
                the leftJoin on Approvals table assumes a record exists and does an update
                I added a preEdit on the controller to insert the record first

                if record already has a user name then they are un-checking the approved box
                    so tell the Controller to delete the record, not insert

            d = new Date($.now());

                .edit($(thisRow).closest('tr'), false)
                .set('SDPlus_Approvals.WorkLog_PK_ID', selectedpkID)
                .set('SDPlus_Approvals.ApprovedBy', (approvedBy == null) ? userName : 'delete')
                .set('SDPlus_Approvals.ApprovedDate', d)


  • montoyammontoyam Posts: 568Questions: 136Answers: 5

    ahhh, nevermind...

    I noticed I had

    $('#SDPlus_BillableItems').on('change' ...

    that is why .preventDefault() didn't work.

    I changed it to .on('click' ... and everything appears to be working great.

Sign In or Register to comment.