We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to use Autocomplete inside EventEditorTemplate

Hi,
I want to use a autocomplete in a textbox inside a eventeditortemplate. When i configure it, the first time i open the editor, by double click on cell, it work fine, but, if i click to open it again, i got the error in console "Failed to execute 'closest' on 'Element': '.' is not a valid selector.".

Can you help me?

Thank you.

3 Replies

NR Nevitha Ravi Syncfusion Team April 4, 2019 05:32 AM UTC

Dear Customer, 

Greetings from Syncfusion Support. 

We suspect that autocomplete control is not rendered properly which might throw the reported script error. Kindly refer the following sample link in which autocomplete works fine within editor template. 

        editorTemplate: '#EventEditorTemplate', 
        popupOpen: function (args) { 
            if (args.type === 'Editor') { 
                var statusElement = args.element.querySelector('#EventType'); 
                if (!statusElement.classList.contains('e-autocomplete')) { 
                  var autoCompleteObject = new ej.dropdowns.AutoComplete({ 
                        placeholder: 'Select a status', value: statusElement.value, 
                        dataSource: ['New', 'Requested', 'Confirmed'] 
                    }); 
                    autoCompleteObject.appendTo(statusElement); 
                    statusElement.setAttribute('name', 'EventType'); 
                } 
              

Please check the sample if you still face the problem revert us back with your code or else try to reproduce it in the above sample. 

Regards, 
Nevitha 



S_ S_Line April 10, 2019 11:54 AM UTC

Thank you! It working fine now!



KK Karthigeyan Krishnamurthi Syncfusion Team April 11, 2019 03:40 AM UTC

Dear Customer,  
 
We are happy that our solution resolved your issue. 
 
Regards, 
Karthi 


Loader.
Live Chat Icon For mobile
Up arrow icon