AutoComplete On Change event

2
We are using the Autocomplete widget in a list view. When changed, the on change event triggers multiple times (anywhere from 2-10+)  When using the widget in a data view triggering the same event only occurs once.  Has anyone else experienced an issue like this?  
asked
4 answers
3

Hi Querin, 

There is event propagation that is triggered when the widget is placed in the list view, the additional line of code:

e.params.originalSelect2Event.stopPropagation();

should take care of this issue (see below): 

             .on("select2:select", function(e) {

                // set the value                
                if( e.params && e.params.data ){                        
                    var guid = e.params.data.id;                        
                    self._contextObj.addReference(self._reference, guid);
                }

                // run the OC microflow if one has been configured.                   
                if( self.onChangeMicroflow ) {
                    self._execMf(self._contextObj.getGuid(), self.onChangeMicroflow);
                    e.params.originalSelect2Event.stopPropagation();
                }
            })

Would be happy to send over the update mpk, I will be submitting this to the widget developer as well. 

answered
0

I'm currently dealing with this same issue. Did anyone manage to find a solution or has anyone been able to speak to the developer of this widget yet?

answered
0

Hi! 

Unfortunately, even after applying your fix the error behavior is still appearing.

Moreover there is an error in the Console: Cannot read property 'stopPropagation' of undefined TypeError: Cannot read property 'stopPropagation' of undefined

Is there any other solution which have been tested to be working fine?

Thanks in advance!

Cheers, Bart

answered
0

I just ran into this issue again, it seemed at first that the issue was fixed with Aaron's answer but somewhere along the way it broke again. 

After checking the AutoCompelete's github, I saw Eric Tieniber submitted a pull request with a fix! I downloaded the widget from his github and the on change events only triggered once! 

Here is a link to Eric's fix:

https://github.com/AuraQ/AutoCompleteForMendix/tree/2a0d446eb57e088db6de157cd45ea25d054c96cc

 

and a link to the autocomplete's github:

https://github.com/AuraQ/AutoCompleteForMendix

 

Thank you Eric!

answered