Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
Openlayers on select function not always triggering

I have a map, with features that are recreated every 1 second. (layer is deleted, and recreated, with new features, new coords)

I have a function that create selection :

       selectInteraction = new Select({
          toggleCondition: this.isMultipleSelectionEnable
            ? null
            : ol.events.condition.never,

          style: self.selectedFeatureStyle,
          // and so on...
         }

        this.selectInteraction.on(['select'], function (e) {
          console.log('on select')
          self.parentRef.list.goToItem()
        })

and as you can see, on feature select, I call a method (on ref component, passed as props) that find and scroll to the selected item in a list, which is the same as selected in map. This is working like a charm, but this function is not always triggered whenever I select a feature.

I click on a feature, I have the selected feature style and everything that is related to selection, but this "this.selectInteraction.on(['select']" is not always triggering.

It's like the behaviour is really random, I can click 2 times on a same feature and have no trigger of the function, but the 3rd click will trigger it. I can click once on a feature and have the trigger, and deselect/reselect the same feature and it won't work.

If anyone has an idea why this function is not always fired on selection, that would be great, and if you need any additionnal informations, feel free to ask

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!