Run button, hide/disable some row's checkbox

Using run button to delete some rows, but when the run button is on the Grid, all rows can be selected and deleted, if there’s some row don’t want the user to delete, in the button’s OnRecord event do some coding and tell the user cannot delete. Could that be easier? such as just not display or disable the checkboxes of some row?

Thanks.

AFAIK you can’t. This is the way run button works,

jerry,

To make the run button checkbox disappear on certain records, use the following in the grid’s onRecord event:



if ({a} != 42) {  // Whatever you need to test[INDENT]echo "<style>#NM_ck_run" . $this->SC_seq_page . " { display:none; }</style>";
[/INDENT]
 }


Be warned though, if the “Check All” is clicked, it may still check the invisible checkbox - I have not tested to see if this is the case, just guessing.

Dave

@daveprue That’s a solution, and thank you very much.

I will test it and post here, thank you very much.

It’s important to the end users that know the row’s state on a glance of the grid.

As I tested, it works, thank you daveprue.

I put it into the grid and in the RunButton’s OnRecord event to delete rows which user selected.

if ({a} != 42) { // Whatever you need to test
echo “<style>#NM_ck_run” . $this->SC_seq_page . " { display:none; }</style>";
}

But Even is not seen, still selected on clicking the checkall checkbox, can handle code in the RunButton’s onRecord like this:

if({a}!=42){ //exactly the condition on the above
sc_exec_sql(“DELETE FROM table WHERE id={id}”);
}

And it works fine. Thank you again, it really useful for me.

[QUOTE=daveprue;32075]jerry,

To make the run button checkbox disappear on certain records, use the following in the grid’s onRecord event:



if ({a} != 42) {  // Whatever you need to test[INDENT]echo "<style>#NM_ck_run" . $this->SC_seq_page . " { display:none; }</style>";
[/INDENT]
 }


Be warned though, if the “Check All” is clicked, it may still check the invisible checkbox - I have not tested to see if this is the case, just guessing.

Dave[/QUOTE]

Good tip, thanks

for check all i resolving with this echo “<style>#NM_ck_run0 { display:none; }</style>”; onheader event

Hello

tried this trick in version 9.2 and it works for first time loading of the grid, but if I sort on a column or use next/prev, then the checkbox is back. Do you have any ideas how to deal with that?

1 Like

Try on OnScriptInit event.
echo “#id_debug_window { display:none; }”;