Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: #746

Open
maclynn147 opened this issue Jul 18, 2024 · 1 comment
Open

[Bug]: #746

maclynn147 opened this issue Jul 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@maclynn147
Copy link

Bug description

tom-select.ts:2244 Uncaught TypeError: Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'.
at J.insertAtCaret (tom-select.ts:2244:10)
at J. (tom-select.ts:1858:9)
at R (utils.ts:87:5)
at J.addItem (tom-select.ts:1829:3)
at J.onOptionSelect (tom-select.ts:838:10)
at HTMLDivElement. (tom-select.ts:297:10)

Expected behavior

new TomSelect('#select-state',{
valueField: 'label',
labelField: 'label',
searchField: ['label','type'],
// fetch remote data
load: function(query, callback) {
var self = this;
if( self.loading > 1 ){
callback();
return;
}

		var url = 'https://whatcms.org/API/List';
		fetch(url)
			.then(response => response.json())
			.then(json => {
				callback(json.result.list);
				self.settings.load = null;
			}).catch(()=>{
				callback();
			});

	},
	// custom rendering function for options
	render: {
		option: function(item, escape) {
			return `<div class="py-2 d-flex">
						<div class="mb-1">
							<span class="h5">
								${ escape(item.label) }
							</span>
						</div>
				 		<div class="ms-auto">${ escape(item.type.join(', ')) }</div>
					</div>`;
		},
                   item: function(item, escape) {
                      console.log(item);
                   }
	},
});

Steps to reproduce

  1. Go to ...
  2. Click on ....
    ...
    X. See error

Additional context

  • OS: [e.g. iOS, Windows]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]
  • Device: [e.g. iPhone6]
@maclynn147 maclynn147 added the bug Something isn't working label Jul 18, 2024
@yads
Copy link

yads commented Aug 13, 2024

your item render doesn't return anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants