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
    Support/Outsourcing/Mentoring for projects migration to Cuba-Platform

    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-03-2015, 12:51 AM.
      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
            Support/Outsourcing/Mentoring for projects migration to Cuba-Platform

            Comment


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

              Comment


              • #8
                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?

                Comment

                Working...
                X