Announcement

Collapse
No announcement yet.

Run button, hide/disable some row's checkbox

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

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

  • #2
    AFAIK you can't. This is the way run button works,
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      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-02-2015, 11:51 PM.
      Dave Prue
      Code Whisperer
      Lahar International Corp
      www.lahar.net

      Comment


      • #4
        @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.

        Comment


        • #5
          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.

          Comment


          • #6
            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
            /Giuseppe

            Professional Scriptcase Services
            Some Customers opinions

            Comment

            Working...
            X