Welcome to the JavaScript feedback portal. We’re happy you’re here! If you have feedback on how to improve the JavaScript, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Greetings,
I want a JS ListBox component run a function when it is created (mainly to fit its toolbar to a certain design):
const listbox = new ej.dropdowns.ListBox({
dataSource: data,
fields: { text: 'id' },
scope: '#scope',
toolbarSettings: { items: ['moveTo', 'moveFrom'], position: 'Left' },
created: fixToolbar('#scope'),
});But I found out that 'created: fixToolbar()' actually runs before the component is fully created so I can't poke to the nodes that are rendered when created (the toolbar).
Afterwards found out that if I do
listbox.addEventListener('created', fixToolbar('#scope'));it works as intended, but the thing is that this fixToolbar() function doesn't return anything - it needs to be passed to addEventListener as an anonymous function. But when I do something like
listbox.addEventListener('created', () => { fixToolbar('#scope') });
or even
listbox.addEventListener('created', function() { fixToolbar('#scope') });
the function fixToolbar() won't run at all.
I'm running EJ2 23.2.4 if that matters.