Skip to content

onInitialized is not totally initialized #1281

@FVZGmbH

Description

@FVZGmbH

I try to point the filter of the multiselect to add some stuff. But as it seems the child nodes are not in DOM at this time.
I use a specific template for the filter.

jQuery('select[multiple="multiple"]').multiselect({
		buttonWidth: '300px',
		enableCaseInsensitiveFiltering: true,
		filterPlaceholder: 'Filtern...',
		includeSelectAllOption: true,
		selectAllJustVisible: true,
		buttonTextAlignment: 'start',
		selectAllText: 'Alle auswählen',
		allSelectedText: 'Alle ausgewählt',
		nonSelectedText: 'Auswählen',
		nSelectedText: ' ausgewählt',
		buttonClass:' form-select text-start',
		templates: {
			filter: '<div class="multiselect-filter d-flex align-items-center"><i class="fas fa-sm fa-search text-muted"></i><input type="search" class="multiselect-search form-control" data-selectAllText-original="Alle auswählen"  data-selectAllText-filtered="Alle gefilterten auswählen" /></div>'
		},
		onInitialized: function(select, container) {
			console.log(container.children('.multiselect-container').children().length) // result: 0, should be count of select->options plus 1 (the filter tag) 
	}
});

I can't find any solution to wait till everything is in place to alter some things

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions