Disable checkbox for run button

Hi,

I have a list of records and only allow user to approve the records based on certain condition.I would need to allow user to mass tick the record and approve.

I have a grid and I created a button with type as “Run”. There will be a checkbox beside each record for user to tick, however I do not want this checkbox to be available if it meet the condition.

Can anyone kindly advise? or is there any other ways can be done?

Thanks.

let users first enter the condition in a pre-screen, then show the screen containing the condition. I don’t know how to do this differently in SC tbh.

the condition is record-related or equal for all records?

Probably you can make it with some javascript , I made somenthing like that if I found the code I’ll post it.

I cannot give you the solution, but you can start from this. I had to change some color or text attribute on a grid, so I wrote a javscript function and called on the onload event of the page.
I changed some row attribute based on the text of the second column, so:

<script>
function margine()
{
    $(".scGridTabela").find('tr').each( function() {

        var testo = $(this).children('td').eq(1).text();

        if ( testo.toUpperCase().indexOf('MARGIN') >= 0 )
        {
            $(this).css("font-weight", "bold");

            $(this).children('td').eq(1).css("background-color", "#AAAAAA");    
            $(this).children('td').css("background-color", "#AAAAAA");        

        }

        if ( testo.toUpperCase().indexOf('TOTALE') >= 0 )
        {
            $(this).css("font-weight", "bold");

        }

    } );
}

</script>

So you can on the OnRecord event, put some TEXT or anything you can retrieve via javascript on the row to “mark to disable”, then in javascript row by row check if there is TEXT and the disable the checkbox.

In my code I set BOLD for rows that second column contains TOTALE, or BOLD and drak gray background if the second colum text contains MARGINE.

I hope this helps.

use CSS to hide the button(s). #NM_ck_run0 is the ID of the ‘select-all’-runbutton; NM_ck_run1 the checkbox on the first row, NM_ck_run2 on the second row,… Use the {sc_seq_register} macro to get the grids record-line.

Example OnRecord event

if (your condition){
   echo '<style>#NM_ck_run'.{sc_seq_register}.'{display:none;}</style>' // hide checkbox on row X
}else{
   echo '<style>#NM_ck_run'.{sc_seq_register}.'{display:initial;}</style>' // show checkbox on row X
}

echo '<style>#NM_ck_run0{display:none;}</style>'; // hides top checkbox to select/unselect all checkboxes