0 Replies Latest reply: Apr 15, 2012 7:35 PM by Patrick Vinton RSS

    Why is setTimeout() required when calling SelectTextsInColumn() ?

    Patrick Vinton

      Can anybody think why I would need to wait in order for the SelectTextsInColumn() function to work?

       

      For example, this does NOT work:

         _this.Data.SelectTextsInColumn(0, false, 'my selection');

       

      But when I wait 1ms, it works perfectly:

         setTimeout( function() { _this.Data.SelectTextsInColumn(0, false, 'my selection'); },1);

       

       

      As you can see in this example, all of the arguments for SelectTextsInColumn() are hard-coded, so I don't think my code has to wait for some other asynchronous operation to complete.

       

      Has anybody else seen this behavior?

       

      In case it helps, I am using javascript inside of an extension.

       

      Thanks in advance for your help!