Announcement

Collapse
No announcement yet.

Run button, hide/disable some row's checkbox

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • jerry
    started a topic Run button, hide/disable some row's checkbox

    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.

  • ltofte
    replied
    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?

    Leave a comment:


  • rinolt
    replied
    for check all i resolving with this echo "<style>#NM_ck_run0 { display:none; }</style>"; onheader event

    Leave a comment:


  • Giu
    replied
    Originally posted by daveprue View Post
    jerry,

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

    Code:
    if ({a} != 42) {  // Whatever you need to test
    echo "<style>#NM_ck_run" . $this->SC_seq_page . " { display:none; }</style>";
    }
    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
    Good tip, thanks

    Leave a comment:


  • jerry
    replied
    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.

    Leave a comment:


  • jerry
    replied
    @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.

    Leave a comment:


  • daveprue
    replied
    jerry,

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

    Code:
    if ({a} != 42) {  // Whatever you need to test
    echo "<style>#NM_ck_run" . $this->SC_seq_page . " { display:none; }</style>";
    }
    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
    Last edited by daveprue; 02-03-2015, 12:51 AM.

    Leave a comment:


  • Giu
    replied
    AFAIK you can't. This is the way run button works,

    Leave a comment:

Working...
X