Page 1 of 1

When delete checkbox checked...

Posted: Sun Apr 26, 2020 6:08 pm
by amit
HI,

If the delete checkbox is check in a subgrid, I want the corresponding line to be hightlighed red and and also disabled. That makes it easier to visually see that a line is marked for deletion. Is it possible to do this with JavaScript?

Re: When delete checkbox checked...

Posted: Mon Apr 27, 2020 1:24 am
by admin
amit,

A Lookup Object has a clickdelete event.

https://wiki.nubuilder.cloud/ ... ustom_Code

Try changing background color here.


Steven

Re: When delete checkbox checked...

Posted: Mon Apr 27, 2020 2:12 am
by kev1n
As Steven suggested, add a clickdelete event to your Subform Object.
deleteClicked.jpg
Then, in your Form's Custom Code field add this JavaScript to cross out and turn the text red of a row that is marked to delete:

Code: Select all

function deleteClicked(event) {

    var id = event.target.id;
    var sf = "sfObj"; //<----- replace with your Subform Object ID !

    var row = id.substring(sf.length, sf.length + 3);
    style = $('#' + id).is(":checked") ? {
        'color': 'red'
        , 'text-decoration': 'line-through'
    } : {
        'color': 'black'
        , 'text-decoration': 'none'
    };

    $('[id^=' + sf + nuPad3(row) + ']').css(style);

}
subform_strike_through.gif