Onchange Event

3 posts, 1 answers
  1. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 06 Apr 2017 Link to this post

    When the user clicks in a certain column, we make it into a dropdown (using range.validation(String here). We have to do this because there are over 10,000 rows and adding different validations to each takes too long.

    However - we also have an onchange method, which fires when this dropdown (validation) is added as technically the cell value has changed (from the original value, to the new value which is the same as the original, but part of a validation). Is there any way to stop this event firing? Thanks!

  2. Answer
    Michael
    Michael avatar
    4 posts
    Member since:
    Oct 2016

    Posted 07 Apr 2017 in reply to Marc Link to this post

    I solved this issued in my projects by doing the following:

    var isChanging;
     
    $(document).ready(function(){  
        isChanging = true;
        //do validation setting here
        isChanging = false;
    });
     
    function onChange(row,col,cell){
        if(isChanging)
            return;
         
        //other change logic here
    }
  3. Marc
    Marc avatar
    171 posts
    Member since:
    Sep 2016

    Posted 10 Apr 2017 in reply to Michael Link to this post

    Hi Michal,

    This is a great solution. I'm quite annoyed as I had already implemented this type of thing for when I initially populate the spreadsheet, so I do the same thing with a variable called intialDataLoad. Thanks again for the help!

    Marc

Back to Top